Extract adding notification observer functions into one method
This commit is contained in:
parent
c79624caf0
commit
628ae11e35
1 changed files with 7 additions and 3 deletions
|
|
@ -120,13 +120,17 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func addNotificationObservers() {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
setNavigationItemTitle()
|
setNavigationItemTitle()
|
||||||
initPasswordsTableEntries()
|
initPasswordsTableEntries()
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(PasswordsViewController.actOnPasswordUpdatedNotification), name: NSNotification.Name(rawValue: "passwordUpdated"), object: nil)
|
addNotificationObservers()
|
||||||
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: passwordsTableEntries)
|
generateSections(item: passwordsTableEntries)
|
||||||
tableView.delegate = self
|
tableView.delegate = self
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue