From 66ee7e07d92a3e22c8e8c3503841ffb5f7a7cd18 Mon Sep 17 00:00:00 2001 From: Stephen Sowole Date: Wed, 27 Feb 2019 17:56:44 -0800 Subject: [PATCH] Update README.md --- README.md | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 20750db..58bf423 100644 --- a/README.md +++ b/README.md @@ -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