From 895439f385e7d1b7a45289d5f0a6da46a2542730 Mon Sep 17 00:00:00 2001 From: Victor C Tavernari Date: Mon, 1 Jul 2019 16:13:18 -0300 Subject: [PATCH 1/3] added feature to close when pan on UIScrollView --- Source/SPStorkController/SPStorkController.swift | 6 ++++++ .../SPStorkPresentationController.swift | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/SPStorkController/SPStorkController.swift b/Source/SPStorkController/SPStorkController.swift index 92c7afa..6bd8192 100755 --- a/Source/SPStorkController/SPStorkController.swift +++ b/Source/SPStorkController/SPStorkController.swift @@ -41,10 +41,16 @@ public enum SPStorkController { return } } + + if let pan = presentationController.pan{ + presentationController.handlePan(gestureRecognizer: pan) + } + if presentationController.pan?.state != UIGestureRecognizer.State.changed { presentationController.scrollViewDidScroll(translation * 2) } } else { + presentationController.updatePresentedViewForTranslation(inVerticalDirection: translation) presentationController.setIndicator(style: .arrow) presentationController.scrollViewDidScroll(0) } diff --git a/Source/SPStorkController/TransitioningDelegate/SPStorkPresentationController.swift b/Source/SPStorkController/TransitioningDelegate/SPStorkPresentationController.swift index fcba812..4d64759 100755 --- a/Source/SPStorkController/TransitioningDelegate/SPStorkPresentationController.swift +++ b/Source/SPStorkController/TransitioningDelegate/SPStorkPresentationController.swift @@ -396,7 +396,7 @@ extension SPStorkPresentationController { }) } - private func updatePresentedViewForTranslation(inVerticalDirection translation: CGFloat) { + func updatePresentedViewForTranslation(inVerticalDirection translation: CGFloat) { if self.startDismissing { return } let elasticThreshold: CGFloat = 120 From f373439dd79e2687a8d5f49893c347cd9996ece2 Mon Sep 17 00:00:00 2001 From: Victor C Tavernari Date: Mon, 1 Jul 2019 16:20:20 -0300 Subject: [PATCH 2/3] updating readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f245092..e0ab4c4 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,8 @@ pod 'SPFakeBar' If you use `UIScrollView` (or UITableView & UICollectionView) on controller, I recommend making it more interactive. When scrolling reaches the top position, the controller will interactively drag down, simulating a closing animation. Also available close controller by drag down on `UIScrollView`. To do this, set the delegate and in the function `scrollViewDidScroll` call: +To enable swipe down you have to enable bounce on top. + ```swift func scrollViewDidScroll(_ scrollView: UIScrollView) { SPStorkController.scrollViewDidScroll(scrollView) From 3ccdd10b5acc7ca6ed0787bd240c7cd92f629daf Mon Sep 17 00:00:00 2001 From: Victor C Tavernari Date: Mon, 1 Jul 2019 16:50:23 -0300 Subject: [PATCH 3/3] removed unsed code --- Source/SPStorkController/SPStorkController.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/SPStorkController/SPStorkController.swift b/Source/SPStorkController/SPStorkController.swift index 6bd8192..d1e193a 100755 --- a/Source/SPStorkController/SPStorkController.swift +++ b/Source/SPStorkController/SPStorkController.swift @@ -42,10 +42,6 @@ public enum SPStorkController { } } - if let pan = presentationController.pan{ - presentationController.handlePan(gestureRecognizer: pan) - } - if presentationController.pan?.state != UIGestureRecognizer.State.changed { presentationController.scrollViewDidScroll(translation * 2) }