2015-04-16 20:47:03 +08:00
|
|
|
<img src="http://snapkit.io/images/banner.png" alt="" />
|
2015-04-12 18:36:02 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
|
2014-07-29 08:39:59 +08:00
|
|
|
|
2015-04-15 19:07:50 +08:00
|
|
|
[![Build Status](https://travis-ci.org/SnapKit/SnapKit.svg)](https://travis-ci.org/SnapKit/SnapKit)
|
2015-05-28 10:08:18 +08:00
|
|
|
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://img.shields.io/cocoapods/v/SnapKit.svg)
|
|
|
|
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
|
2015-03-24 06:45:35 +08:00
|
|
|
|
2014-07-29 08:39:59 +08:00
|
|
|
```swift
|
2015-04-16 20:47:03 +08:00
|
|
|
import SnapKit
|
2014-07-29 08:39:59 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
class MyViewController: UIViewController {
|
2014-07-29 08:39:59 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
lazy var box = UIView()
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
|
|
|
|
self.view.addSubview(box)
|
|
|
|
box.snp_makeConstraints { (make) -> Void in
|
|
|
|
make.width.height.equalTo(50)
|
|
|
|
make.center.equalTo(self.view)
|
|
|
|
}
|
2014-07-29 08:39:59 +08:00
|
|
|
}
|
2015-04-16 20:47:03 +08:00
|
|
|
|
2014-07-29 08:39:59 +08:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
## Resources
|
2014-12-05 09:36:41 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
* [Documentation](http://snapkit.io/docs/)
|
|
|
|
* [F.A.Q.](http://snapkit.io/faq/)
|
2015-09-22 15:44:12 +08:00
|
|
|
* [Legacy Platforms (< iOS 8.0, < OS X 10.10)](https://github.com/SnapKit/SnapKit/blob/develop/LEGACY_PLATFORMS.md)
|
2014-12-05 09:36:41 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
## License
|
2014-07-29 08:39:59 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
MIT license. See the `LICENSE` file for details.
|