From 57f45813220c19f0b545384dab785a2442aa52d7 Mon Sep 17 00:00:00 2001 From: Keith Lamprecht <1894492+Nixon506E@users.noreply.github.com> Date: Mon, 22 Jul 2019 15:34:01 -0400 Subject: [PATCH 1/4] Designate new drawer position on transition Don't default to collapsed state when current drawer position isn't supported --- PulleyLib/PulleyViewController.swift | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/PulleyLib/PulleyViewController.swift b/PulleyLib/PulleyViewController.swift index 7d60436..2277520 100644 --- a/PulleyLib/PulleyViewController.swift +++ b/PulleyLib/PulleyViewController.swift @@ -1309,7 +1309,7 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel - parameter animated: Whether or not to animate the change. - parameter completion: A block object to be executed when the animation sequence ends. The Bool indicates whether or not the animations actually finished before the completion handler was called. */ - public func setDrawerContentViewController(controller: UIViewController, animated: Bool = true, completion: PulleyAnimationCompletionBlock?) + public func setDrawerContentViewController(controller: UIViewController, animated: Bool = true, toPosition: PulleyPosition? = nil, completion: PulleyAnimationCompletionBlock?) { // Account for transition issue in iOS 11 controller.view.frame = drawerContentContainer.bounds @@ -1320,17 +1320,25 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel UIView.transition(with: drawerContentContainer, duration: 0.5, options: .transitionCrossDissolve, animations: { [weak self] () -> Void in self?.drawerContentViewController = controller - self?.setDrawerPosition(position: self?.drawerPosition ?? .collapsed, animated: false) - }, completion: { (completed) in - - completion?(completed) + if let toPosition = toPosition { + self?.setDrawerPosition(position: toPosition, animated: false) + } else { + self?.setDrawerPosition(position: self?.drawerPosition ?? .collapsed, animated: false) + } + }, completion: { (completed) in + completion?(completed) }) } else { drawerContentViewController = controller - setDrawerPosition(position: drawerPosition, animated: false) + + if let toPosition = toPosition { + setDrawerPosition(position: toPosition, animated: false) + } else { + setDrawerPosition(position: drawerPosition, animated: false) + } completion?(true) } From 2aa87e2a40ad42b77da22e0e383cfbe6e9454703 Mon Sep 17 00:00:00 2001 From: Keith Lamprecht <1894492+Nixon506E@users.noreply.github.com> Date: Wed, 18 Sep 2019 10:44:46 -0400 Subject: [PATCH 2/4] Add UITableView Scroll Delegate --- PulleyLib/PulleyPassthroughTableView.swift | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 PulleyLib/PulleyPassthroughTableView.swift diff --git a/PulleyLib/PulleyPassthroughTableView.swift b/PulleyLib/PulleyPassthroughTableView.swift new file mode 100644 index 0000000..91cc253 --- /dev/null +++ b/PulleyLib/PulleyPassthroughTableView.swift @@ -0,0 +1,30 @@ +// +// PulleyPassthroughTableView.swift +// Pulley +// +// Created by Keith Lamprecht on 9/18/19. +// +import UIKit + +protocol PulleyPassthroughTableViewDelegate: class { + + func shouldTouchPassthroughScrollView(scrollView: PulleyPassthroughTableView, point: CGPoint) -> Bool + func viewToReceiveTouch(scrollView: PulleyPassthroughTableView, point: CGPoint) -> UIView +} + +class PulleyPassthroughTableView: UITableView { + + weak var touchDelegate: PulleyPassthroughTableViewDelegate? + + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + + if + let touchDelegate = touchDelegate, + touchDelegate.shouldTouchPassthroughScrollView(scrollView: self, point: point) + { + return touchDelegate.viewToReceiveTouch(scrollView: self, point: point).hitTest(touchDelegate.viewToReceiveTouch(scrollView: self, point: point).convert(point, from: self), with: event) + } + + return super.hitTest(point, with: event) + } +} From 33607f5f8c00cb09ad476c25b9658a0a0bd93766 Mon Sep 17 00:00:00 2001 From: Keith Lamprecht <1894492+Nixon506E@users.noreply.github.com> Date: Wed, 18 Sep 2019 10:55:20 -0400 Subject: [PATCH 3/4] Delete PulleyPassthroughTableView.swift --- PulleyLib/PulleyPassthroughTableView.swift | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 PulleyLib/PulleyPassthroughTableView.swift diff --git a/PulleyLib/PulleyPassthroughTableView.swift b/PulleyLib/PulleyPassthroughTableView.swift deleted file mode 100644 index 91cc253..0000000 --- a/PulleyLib/PulleyPassthroughTableView.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// PulleyPassthroughTableView.swift -// Pulley -// -// Created by Keith Lamprecht on 9/18/19. -// -import UIKit - -protocol PulleyPassthroughTableViewDelegate: class { - - func shouldTouchPassthroughScrollView(scrollView: PulleyPassthroughTableView, point: CGPoint) -> Bool - func viewToReceiveTouch(scrollView: PulleyPassthroughTableView, point: CGPoint) -> UIView -} - -class PulleyPassthroughTableView: UITableView { - - weak var touchDelegate: PulleyPassthroughTableViewDelegate? - - override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { - - if - let touchDelegate = touchDelegate, - touchDelegate.shouldTouchPassthroughScrollView(scrollView: self, point: point) - { - return touchDelegate.viewToReceiveTouch(scrollView: self, point: point).hitTest(touchDelegate.viewToReceiveTouch(scrollView: self, point: point).convert(point, from: self), with: event) - } - - return super.hitTest(point, with: event) - } -} From 48ae91699966dc9153d7a9fb764e2474dd2bb6ad Mon Sep 17 00:00:00 2001 From: Keith Lamprecht <1894492+Nixon506E@users.noreply.github.com> Date: Mon, 23 Sep 2019 10:10:30 -0400 Subject: [PATCH 4/4] Remove Supported Positions Change Animation --- PulleyLib/PulleyViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PulleyLib/PulleyViewController.swift b/PulleyLib/PulleyViewController.swift index 2277520..cd9bacf 100644 --- a/PulleyLib/PulleyViewController.swift +++ b/PulleyLib/PulleyViewController.swift @@ -569,7 +569,7 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel if supportedPositions.contains(drawerPosition) { - setDrawerPosition(position: drawerPosition, animated: true) + setDrawerPosition(position: drawerPosition, animated: false) } else {