Navigate:
SnapKit
~$SNAPK0.0%

SnapKit: Swift Auto Layout DSL for iOS and macOS

Swift DSL for type-safe programmatic Auto Layout constraints.

LIVE RANKINGS • 10:20 AM • STEADY
OVERALL
#438
14
MOBILE & DESKTOP
#42
30 DAY RANKING TREND
ovr#438
·Mobil#42
STARS
20.3K
FORKS
2.0K
7D STARS
0
7D FORKS
-2
See Repo:
Share:

Learn more about SnapKit

SnapKit is a Swift library that wraps Apple's Auto Layout system with a declarative DSL. It translates method-chaining syntax into NSLayoutConstraint objects, reducing boilerplate code required for programmatic constraint definition. The library supports constraint relationships like equality, inequality, and multiplier-based sizing across view hierarchies. It is commonly used in iOS and macOS projects where constraints are defined in code rather than Interface Builder.

SnapKit

1

Fluent Constraint Chaining

Constraints are defined through method-chaining syntax in a single closure, eliminating verbose NSLayoutConstraint boilerplate. The declarative DSL translates chained expressions directly into Auto Layout constraints with improved readability.

2

Cross-Platform Auto Layout

Identical constraint code runs on iOS 12.0+, macOS 10.13+, and tvOS 10.0+ without platform-specific modifications. Enables shared layout logic across Apple platforms using the same Swift DSL.

3

Flexible Dependency Integration

Supports CocoaPods, Carthage, Swift Package Manager, and manual installation. Teams can adopt SnapKit using their existing dependency management workflow without tooling changes.


import SnapKit

let box = UIView()
superview.addSubview(box)

box.snp.makeConstraints { make in
    make.edges.equalToSuperview().inset(20)
}


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers