Update README.md

This commit is contained in:
Stephen Sowole 2019-02-27 17:56:44 -08:00 committed by GitHub
parent f2a3fe3644
commit 66ee7e07d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 22 deletions

View File

@ -50,13 +50,13 @@ github "slack/PanModal"
PanModal was designed to be used effortlessly. Simply call `presentPanModal` in the same way you would expect to present a `UIViewController`
```swift
viewControllerA.presentPanModal(viewControllerB)
.presentPanModal(yourViewController)
```
The presented view controller must conform to `PanModalPresentable` to take advantage of the customizable options
```swift
extension ViewControllerB: PanModalPresentable {
extension YourViewController: PanModalPresentable {
var panScrollable: UIScrollView? {
return nil
@ -69,7 +69,7 @@ extension ViewControllerB: PanModalPresentable {
If your view controller has an embedded `UIScrollView` e.g. as is the case with `UITableViewController`, panModal will seamlessly transition pan gestures between the modal and the scroll view
```swift
class ViewControllerC: UITableViewController, PanModalPresentable {
class TableViewController: UITableViewController, PanModalPresentable {
var panScrollable: UIScrollView? {
return tableView
@ -82,15 +82,12 @@ class ViewControllerC: UITableViewController, PanModalPresentable {
Height values of the panModal can be adjusted by overriding `shortFormHeight` or `longFormHeight`
```swift
extension ViewControllerC: PanModalPresentable {
var shortFormHeight: PanModalHeight {
return .contentHeight(300)
}
var shortFormHeight: PanModalHeight {
return .contentHeight(300)
}
var longFormHeight: PanModalHeight {
return .maxHeightWithTopInset(40)
}
var longFormHeight: PanModalHeight {
return .maxHeightWithTopInset(40)
}
```
@ -99,19 +96,19 @@ extension ViewControllerC: PanModalPresentable {
Values are stored during presentation, so when adjusting at runtime you should call `panModalSetNeedsLayoutUpdate()`
```swift
func viewDidLoad() {
hasLoaded = true
func viewDidLoad() {
hasLoaded = true
panModalSetNeedsLayoutUpdate()
panModalTransition(to: .shortForm)
}
panModalSetNeedsLayoutUpdate()
panModalTransition(to: .shortForm)
}
var shortFormHeight: PanModalHeight {
if hasLoaded {
return .contentHeight(200)
}
return .maxHeight
}
var shortFormHeight: PanModalHeight {
if hasLoaded {
return .contentHeight(200)
}
return .maxHeight
}
```
### Sample App