MasonryMasonry
Guide
  • Objective-C API
  • Swift API
Examples
Changelog
  • English
  • 简体中文
GitHub
Guide
  • Objective-C API
  • Swift API
Examples
Changelog
  • English
  • 简体中文
GitHub
  • Guide

    • Getting Started
    • Installation
    • Basic Usage

Installation

Masonry supports multiple installation methods. Choose the one that best fits your project.

Swift Package Manager (Recommended)

Add Masonry to your Package.swift:

dependencies: [
    .package(url: "https://github.com/AmatsuZero/Masonry.git", from: "1.3.4")
]

Two library products are available:

ProductDescription
MasonryObjective-C core module
MasonrySwiftSwift native DSL (depends on Masonry)

Add the desired product to your target's dependencies:

.target(
    name: "YourApp",
    dependencies: [
        .product(name: "MasonrySwift", package: "Masonry"),
    ]
)

Tips

If you only need the Objective-C API, use Masonry as the product name instead.

CocoaPods

Add to your Podfile:

# Objective-C only
pod 'Masonry'

# Objective-C + Swift DSL
pod 'Masonry/Swift'

Then run:

pod install

Carthage

Add to your Cartfile:

github "AmatsuZero/Masonry"

Then run:

carthage update --use-xcframeworks

Manual Integration

  1. Clone or download the repository
  2. Drag the Masonry folder into your Xcode project
  3. Ensure the source files are added to your target's Compile Sources build phase

Privacy Manifest

Starting with v1.3.2, Masonry ships with an Apple Privacy Manifest (PrivacyInfo.xcprivacy). The manifest declares that Masonry:

  • Does not collect any data
  • Does not use any required-reason APIs
  • Does not track users

Both SPM and CocoaPods integrate the manifest automatically — no extra configuration is needed.

Xcode Code Snippets

The repository includes ready-to-use Xcode code snippets in the CodeSnippets/ directory. Copy them to enable quick autocompletion:

cp CodeSnippets/* ~/Library/Developer/Xcode/UserData/CodeSnippets/

Available snippets:

ShortcutLanguageDescription
mas_makeObjective-Cmas_makeConstraints block
mas_updateObjective-Cmas_updateConstraints block
mas_remakeObjective-Cmas_remakeConstraints block
mas_swift_makeSwiftmas.makeConstraints closure
mas_swift_updateSwiftmas.updateConstraints closure
mas_swift_remakeSwiftmas.remakeConstraints closure
Edit this page on GitHub
Last Updated: 3/29/26, 12:09 PM
Contributors: samzhjiang
Prev
Getting Started
Next
Basic Usage