3D touch to search

This commit is contained in:
Bob Sun 2017-02-08 12:47:05 +08:00
parent 563156b0a4
commit 97056ab91c
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
3 changed files with 36 additions and 0 deletions

View file

@ -64,6 +64,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
NotificationCenter.default.addObserver(self, selector: #selector(PasswordsViewController.actOnPasswordUpdatedNotification), name: NSNotification.Name(rawValue: "passwordUpdated"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(PasswordsViewController.actOnPasswordStoreErasedNotification), name: NSNotification.Name(rawValue: "passwordStoreErased"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(PasswordsViewController.actOnSearchNotification), name: NSNotification.Name(rawValue: "search"), object: nil)
generateSections(item: passwordEntities!)
tableView.delegate = self
@ -196,6 +197,10 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
reloadTableView(data: passwordEntities!)
}
func actOnSearchNotification() {
searchController.searchBar.becomeFirstResponder()
}
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {