Build responsive iOS apps that adapt to different screen sizes and orientations without writing verbose constraint code.
Create Mac OS X desktop applications with clean, readable layout definitions using chainable syntax.
Set up complex view hierarchies with spacing, padding, and alignment rules in fewer lines of code.
Define constraint priorities so some layout rules can be broken when screen space is limited.
Masonry is an Objective-C library for iOS and Mac OS X that simplifies the way developers define layout rules (called Auto Layout constraints) for user interface elements. Auto Layout is Apple's system for positioning views on screen in a way that adapts to different screen sizes and orientations. Normally, writing these constraints in code is very verbose, a single simple rule like "this view should fill its parent with 10 points of padding on each side" requires many lines of repetitive, hard-to-read code. Masonry provides a cleaner, chainable syntax for the same thing. Instead of constructing constraint objects manually, you use a block-based API where you describe relationships in a natural way, such as "make this view's edges equal to its superview's edges with insets." The library automatically attaches the constraints to the right views and handles the usual boilerplate of disabling autoresizing translation. It supports all standard layout attributes: position, size, centering, and spacing, as well as setting priorities so that some constraints can be broken when space is tight. The project recommends its Swift-language counterpart, SnapKit, for projects written in Swift, since Swift offers better type safety. Masonry itself remains actively maintained for Objective-C projects. It is available via CocoaPods and Carthage, the common iOS dependency managers.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.