Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. Masonry

Masonry

MITObjective-Cv1.1.0

A lightweight iOS/macOS layout framework that wraps AutoLayout with a chainable, expressive DSL.

GitHubGitHub
18.2k stars3.2k forks0 contributors

What is Masonry?

Masonry is a lightweight layout framework for iOS and macOS that wraps Apple's AutoLayout system with a simplified, chainable, and expressive syntax. It solves the problem of AutoLayout's verbose and hard-to-read code by providing a Domain-Specific Language (DSL) that makes creating and managing NSLayoutConstraints concise and readable.

Target Audience

iOS and macOS developers building user interfaces with AutoLayout who want to write more maintainable and readable layout code, especially those working in Objective-C.

Value Proposition

Developers choose Masonry because it provides the full power of AutoLayout without the verbosity, using a clean, chainable API that reads like sentences. It offers great debug support and comprehensive constraint management while keeping the global namespace clean.

Overview

Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout

Use Cases

Best For

  • Simplifying complex AutoLayout constraint code in Objective-C projects
  • Making iOS/macOS UI layout code more concise and readable
  • Managing dynamic layout changes and animations with constraint updates
  • Improving debugging of AutoLayout conflicts with meaningful constraint names
  • Writing maintainable layout code for teams
  • Building responsive interfaces that work across different screen sizes

Not Ideal For

  • Swift-based iOS/macOS projects where native Swift APIs and better type safety are prioritized
  • Teams that rely exclusively on Interface Builder or Storyboards for visual layout design
  • Developers building modern UIs with SwiftUI who want a declarative, framework-native approach
  • Projects with very simple, static layouts where the overhead of a DSL doesn't justify added complexity

Pros & Cons

Pros

Expressive Chainable Syntax

Replaces verbose NSLayoutConstraint code with a readable, sentence-like DSL—turning multiple lines into concise chains like `make.edges.equalTo(superview).with.insets(padding)`.

Full AutoLayout Coverage

Supports all NSLayoutConstraint capabilities without limitations, allowing complex constraints like priorities, inequalities, and arrays of views.

Robust Constraint Management

Provides dedicated methods for creating (`mas_makeConstraints`), updating (`mas_updateConstraints`), and remaking (`mas_remakeConstraints`) layouts, simplifying dynamic UI changes.

Enhanced Debugging

Assigns meaningful names to constraints in AutoLayout error console output, making it easier to identify and resolve conflicts compared to raw AutoLayout.

Automatic Boilerplate Handling

Automatically sets `translatesAutoresizingMaskIntoConstraints = NO` and adds constraints to appropriate views, reducing manual setup errors.

Cons

Objective-C Centric Design

The README explicitly recommends SnapKit for Swift projects, as Masonry's Objective-C API lacks native Swift type safety and can feel clunky with bridging headers.

DSL Learning Overhead

Requires developers to learn a new chainable syntax and methods, which can be a barrier for teams comfortable with raw AutoLayout or other frameworks.

Third-Party Dependency Risk

Adds external library reliance, which can complicate updates or migrations, especially as Apple evolves AutoLayout and introduces SwiftUI.

Limited Modern Integration

Does not integrate seamlessly with newer Apple technologies like SwiftUI, forcing developers to mix paradigms or use alternative solutions for modern app development.

Frequently Asked Questions

Quick Stats

Stars18,197
Forks3,152
Contributors0
Open Issues129
Last commit3 years ago
CreatedSince 2013

Tags

#ios#appkit#objective-c#dsl#ui-layout#macos#autolayout#uikit#constraints

Included in

iOS51.7k
Auto-fetched 1 day ago

Related Projects

SnapKitSnapKit

A Swift Autolayout DSL for iOS & OS X

Stars20,334
Forks2,042
Last commit11 months ago
YogaKitYogaKit

Yoga is an embeddable layout engine targeting web standards.

Stars18,720
Forks1,531
Last commit3 days ago
FDTemplateLayoutCellFDTemplateLayoutCell

Template auto layout cell for automatically UITableViewCell height calculating

Stars9,877
Forks1,992
Last commit4 years ago
PureLayoutPureLayout

The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. Objective-C and Swift compatible.

Stars7,603
Forks731
Last commit3 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub