Support swipe back when viewing folder #141
This commit is contained in:
parent
6538634680
commit
1afef16fa1
1 changed files with 14 additions and 0 deletions
|
|
@ -229,6 +229,11 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
|||
// reset the data table if the disaply settings have been changed
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(actOnReloadTableViewRelatedNotification), name: .passwordDisplaySettingChanged, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(actOnSearchNotification), name: .passwordSearch, object: nil)
|
||||
|
||||
// listen to the swipe back guesture
|
||||
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
|
||||
swipeRight.direction = UISwipeGestureRecognizerDirection.right
|
||||
self.view.addGestureRecognizer(swipeRight)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
|
@ -314,6 +319,15 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
|||
}
|
||||
}
|
||||
|
||||
@objc func respondToSwipeGesture(gesture: UIGestureRecognizer) {
|
||||
if let swipeGesture = gesture as? UISwipeGestureRecognizer {
|
||||
// swipe right -> swipe back
|
||||
if swipeGesture.direction == .right && parentPasswordEntity != nil {
|
||||
self.backAction(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc func backAction(_ sender: Any?) {
|
||||
guard SharedDefaults[.isShowFolderOn] else { return }
|
||||
var anim: CATransition? = transitionFromLeft
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue