swipe to dismiss sheet view

pull/1/head
Michael Kirk 7 years ago
parent 17ad905f2d
commit 043b0c8359

@ -66,6 +66,10 @@ public class SheetViewController: UIViewController {
// Gestures
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapBackground))
self.view.addGestureRecognizer(tapGesture)
let swipeDownGesture = UISwipeGestureRecognizer(target: self, action: #selector(didSwipeDown))
swipeDownGesture.direction = .down
self.view.addGestureRecognizer(swipeDownGesture)
}
// MARK: Present / Dismiss animations
@ -123,6 +127,12 @@ public class SheetViewController: UIViewController {
// inform delegate to
delegate?.sheetViewControllerRequestedDismiss(self)
}
@objc
func didSwipeDown() {
// inform delegate to
delegate?.sheetViewControllerRequestedDismiss(self)
}
}
extension SheetViewController: UIViewControllerTransitioningDelegate {

Loading…
Cancel
Save