[PanModal] Track all dismiss events through panModalPresentable callbacks (#91)
This commit is contained in:
parent
17a8231f20
commit
22b4ddd47e
|
|
@ -113,7 +113,7 @@ open class PanModalPresentationController: UIPresentationController {
|
|||
}
|
||||
view.didTap = { [weak self] _ in
|
||||
if self?.presentable?.allowsTapToDismiss == true {
|
||||
self?.dismissPresentedViewController()
|
||||
self?.presentedViewController.dismiss(animated: true)
|
||||
}
|
||||
}
|
||||
return view
|
||||
|
|
@ -192,7 +192,14 @@ open class PanModalPresentationController: UIPresentationController {
|
|||
})
|
||||
}
|
||||
|
||||
override public func presentationTransitionDidEnd(_ completed: Bool) {
|
||||
if completed { return }
|
||||
|
||||
backgroundView.removeFromSuperview()
|
||||
}
|
||||
|
||||
override public func dismissalTransitionWillBegin() {
|
||||
presentable?.panModalWillDismiss()
|
||||
|
||||
guard let coordinator = presentedViewController.transitionCoordinator else {
|
||||
backgroundView.dimState = .off
|
||||
|
|
@ -210,10 +217,10 @@ open class PanModalPresentationController: UIPresentationController {
|
|||
})
|
||||
}
|
||||
|
||||
override public func presentationTransitionDidEnd(_ completed: Bool) {
|
||||
if completed { return }
|
||||
|
||||
backgroundView.removeFromSuperview()
|
||||
override public func dismissalTransitionDidEnd(_ completed: Bool) {
|
||||
if !completed { return }
|
||||
|
||||
presentable?.panModalDidDismiss()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -516,7 +523,7 @@ private extension PanModalPresentationController {
|
|||
transition(to: .shortForm)
|
||||
|
||||
} else {
|
||||
dismissPresentedViewController()
|
||||
presentedViewController.dismiss(animated: true)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -534,7 +541,7 @@ private extension PanModalPresentationController {
|
|||
transition(to: .shortForm)
|
||||
|
||||
} else {
|
||||
dismissPresentedViewController()
|
||||
presentedViewController.dismiss(animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -673,16 +680,6 @@ private extension PanModalPresentationController {
|
|||
else { return number }
|
||||
return nearestVal
|
||||
}
|
||||
|
||||
/**
|
||||
Dismiss presented view
|
||||
*/
|
||||
func dismissPresentedViewController() {
|
||||
presentable?.panModalWillDismiss()
|
||||
presentedViewController.dismiss(animated: true) { [weak self] in
|
||||
self?.presentable?.panModalDidDismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - UIScrollView Observer
|
||||
|
|
|
|||
Loading…
Reference in New Issue