2016-01-26 20:15:01 +08:00
|
|
|
<img src="http://snapkit.io/images/banner.jpg" 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()
|
2016-01-26 20:12:32 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
2016-01-26 20:12:32 +08:00
|
|
|
|
2015-04-16 20:47:03 +08:00
|
|
|
self.view.addSubview(box)
|
2016-05-12 16:50:57 +08:00
|
|
|
box.snp_makeConstraints { make in
|
2015-04-16 20:47:03 +08:00
|
|
|
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:57:29 +08:00
|
|
|
* [Legacy Platforms (iOS 7.0, OS X 10.9)](http://snapkit.io/legacy-platforms/)
|
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.
|