Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class BottomPopupPresentationController: UIPresentationController {
fileprivate var dimmingView: UIView!
fileprivate let popupHeight: CGFloat
fileprivate let dimmingViewAlpha: CGFloat
fileprivate var shouldDismissInteractively: Bool

override var frameOfPresentedViewInContainerView: CGRect {
get {
Expand All @@ -31,9 +32,10 @@ class BottomPopupPresentationController: UIPresentationController {
})
}

init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?, usingHeight height: CGFloat, andDimmingViewAlpha dimmingAlpha: CGFloat) {
init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?, usingHeight height: CGFloat, andDimmingViewAlpha dimmingAlpha: CGFloat, shouldDismissInteractively: Bool) {
self.popupHeight = height
self.dimmingViewAlpha = dimmingAlpha
self.shouldDismissInteractively = shouldDismissInteractively
super.init(presentedViewController: presentedViewController, presenting: presentingViewController)
setupDimmingView()
}
Expand All @@ -52,11 +54,15 @@ class BottomPopupPresentationController: UIPresentationController {
}

@objc private func handleTap(_ tap: UITapGestureRecognizer) {
presentedViewController.dismiss(animated: true, completion: nil)
if shouldDismissInteractively {
presentedViewController.dismiss(animated: true, completion: nil)
}
}

@objc private func handleSwipe(_ swipe: UISwipeGestureRecognizer) {
presentedViewController.dismiss(animated: true, completion: nil)
if shouldDismissInteractively {
presentedViewController.dismiss(animated: true, completion: nil)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BottomPopupTransitionHandler: NSObject, UIViewControllerTransitioningDeleg

//MARK: Specific animators
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
return BottomPopupPresentationController(presentedViewController: presented, presenting: presenting, usingHeight: popupViewController.getPopupHeight(), andDimmingViewAlpha: popupViewController.getDimmingViewAlpha())
return BottomPopupPresentationController(presentedViewController: presented, presenting: presenting, usingHeight: popupViewController.getPopupHeight(), andDimmingViewAlpha: popupViewController.getDimmingViewAlpha(), shouldDismissInteractively: popupViewController.shouldPopupDismissInteractivelty())
}

func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
Expand Down