Update docs

This commit is contained in:
Robert Payne 2017-09-17 15:11:42 +12:00
parent 3b2ee222d7
commit 41c5a71844
1 changed files with 49 additions and 30 deletions

45
docs.md
View File

@ -6,12 +6,8 @@ id: docs
## Requirements ## Requirements
- iOS 8.0+ / Mac OS X 10.11+ / tvOS 9.0+ - iOS 8.0+ / Mac OS X 10.11+ / tvOS 9.0+
- Xcode 8.0+ - Xcode 9.0+
- Swift 3.0+ - Swift 4.0+
## Migration Guides
- [SnapKit 3.0 Migration Guide](https://github.com/SnapKit/SnapKit/blob/master/Documentation/SnapKit%203.0%20Migration%20Guide.md)
## Communication ## Communication
@ -32,7 +28,7 @@ id: docs
$ gem install cocoapods $ gem install cocoapods
``` ```
> CocoaPods 1.1.0+ is required to build SnapKit 3.0.0+. > CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`: To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
@ -42,7 +38,7 @@ platform :ios, '10.0'
use_frameworks! use_frameworks!
target '<Your Target Name>' do target '<Your Target Name>' do
pod 'SnapKit', '~> 3.0' pod 'SnapKit', '~> 4.0'
end end
``` ```
@ -66,7 +62,7 @@ $ brew install carthage
To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`: To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl ```ogdl
github "SnapKit/SnapKit" ~> 3.0 github "SnapKit/SnapKit" ~> 4.0
``` ```
Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project. Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
@ -306,10 +302,10 @@ func changeButtonPosition() {
`topLayoutGuide.snp.bottom` is similar to `topLayoutGuide.bottomAnchor` and you can also use `bottomLayoutGuide.snp.top` to align view on top of UITabBar. `topLayoutGuide.snp.bottom` is similar to `topLayoutGuide.bottomAnchor` and you can also use `bottomLayoutGuide.snp.top` to align view on top of UITabBar.
```swift ```swift
import SnapKit import SnapKit
class MyViewController: UIVewController { class MyViewController: UIVewController {
lazy var tableView = UITableView() lazy var tableView = UITableView()
@ -325,5 +321,28 @@ func changeButtonPosition() {
} }
} }
}
```
### Snap view to safe layout guide
Just like `topLayoutGuide` and `bottomLayoutGuide` using iPhone X's new `safeAreaLayoutGuide` is easy:
```swift
import SnapKit
class MyViewController: UIVewController {
lazy var tableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(tableView)
tableView.snp.makeConstraints { (make) -> Void in
make.top.equalTo(safeAreaLayoutGuide.snp.bottom)
} }
``` }
}