SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.

  • Simple & Expressive chaining DSL allows building constraints with minimal amounts of code while ensuring they are easy to read and understand.
  • Type Safe by design to reduce programmer error and keep invalid constraints from being created in the first place for maximized productivity.
  • Compatible for both iOS and OS X apps installable through Cocoapods or Carthage.
  • Free to use in all projects and licensed under the flexible MIT license.
let box = UIView()
let container = UIView()

container.addSubview(box)

box.snp_makeConstraints { (make) -> Void in
    make.size.equalTo(50)
    make.center.equalTo(container)
}
makes
container
box