SnapKit: Swift Auto Layout DSL for iOS and macOS
Swift DSL for type-safe programmatic Auto Layout constraints.
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.
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.
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.
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)
}Top in Mobile & Desktop
Related Repositories
Discover similar tools and frameworks used by developers
Etcher
Cross-platform app for writing OS images to SD cards and USB drives with data verification.
React Native FS
Cross-platform native filesystem operations for React Native applications.
React Native Maps
Cross-platform React Native bridge to native map SDKs.
DDT4All
Python tool for Renault/Dacia vehicle diagnostics, ECU modification, and CAN bus communication.
React Native Apps
Curated collection of open source React Native and Expo apps showcasing implementation patterns and examples.