Double tap tab bar to scroll to top
This commit is contained in:
parent
8afc40a5a1
commit
9b2a047d38
1 changed files with 16 additions and 0 deletions
|
|
@ -70,6 +70,7 @@ class PasswordNavigationViewController: UIViewController {
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
tabBarController?.delegate = self
|
||||||
configureNavigationItem()
|
configureNavigationItem()
|
||||||
configureTabBarItem()
|
configureTabBarItem()
|
||||||
configureNavigationBar()
|
configureNavigationBar()
|
||||||
|
|
@ -378,6 +379,21 @@ extension PasswordNavigationViewController: UISearchBarDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension PasswordNavigationViewController: UITabBarControllerDelegate {
|
||||||
|
func tabBarController(_: UITabBarController, didSelect viewController: UIViewController) {
|
||||||
|
if viewController == navigationController {
|
||||||
|
let currentTime = Date().timeIntervalSince1970
|
||||||
|
let duration = currentTime - tapTabBarTime
|
||||||
|
tapTabBarTime = currentTime
|
||||||
|
if duration < 0.35, tableView.numberOfSections > 0 {
|
||||||
|
let topIndexPath = IndexPath(row: 0, section: 0)
|
||||||
|
tableView.scrollToRow(at: topIndexPath, at: .bottom, animated: true)
|
||||||
|
tapTabBarTime = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension PasswordNavigationViewController: PasswordAlertPresenter {
|
extension PasswordNavigationViewController: PasswordAlertPresenter {
|
||||||
private func syncPasswords() {
|
private func syncPasswords() {
|
||||||
guard PasswordStore.shared.repositoryExists() else {
|
guard PasswordStore.shared.repositoryExists() else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue