Fix controllers not popping when pressing a tab bar button#53
Fix controllers not popping when pressing a tab bar button#53zats wants to merge 4 commits intotryswift:masterfrom
Conversation
| } | ||
|
|
||
| func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) { | ||
| if let splitViewController = viewController as? UISplitViewController { |
There was a problem hiding this comment.
Maybe guard lets and early exits might make this function a bit more readable?
There was a problem hiding this comment.
I think we can chain the guards to remove two of the ifs. For me it seems more readable to have something like this:
guard
let splitViewController = viewController as? UISplitViewController,
let navigationController = splitViewController.viewControllers.last as? UINavigationController
else { return }
if navigationController.viewControllers.count > 1 {
navigationController.popViewController(animated: true)
} else {
if let firstController = navigationController.viewControllers.first {
if let scrollableToTop = firstController as? ScrollableToTop {
scrollableToTop.scrollAfterTabTap()
} else {
firstController.view.findScrollSubview()?.setContentOffset(.zero, animated: true)
}
}
}4863c93 to
49143f1
Compare
zats
left a comment
There was a problem hiding this comment.
Should be good to go and rebase on the latest master
| settings.style.selectedBarBackgroundColor = .white | ||
| buttonBarView.selectedBar.backgroundColor = .trySwiftAccentColor() | ||
|
|
||
| tabBarController?.delegate = self |
There was a problem hiding this comment.
I removed this since it's handled at a higher level now (RootTabBarController delegates this functionality via protocol conformance now)
| } | ||
| } | ||
|
|
||
| extension ScheduleViewController: UITabBarControllerDelegate { |
There was a problem hiding this comment.
see the comment above, this functionality is handled in a RootTabBarController now
| } | ||
|
|
||
| private extension SessionsTableViewController { | ||
There was a problem hiding this comment.
not to brag but phabricator has a feature of hiding whitespace changes in review - it's pretty cool because it minimizes noise like this in review. I remember there was some sort of secret url parameter when reviewing pull requests… but to be honest I don't even know when I would want to see whitespace changes 🙂
There was a problem hiding this comment.
|
So unless anyone has any concerns I'll be merging this in a few days (to give people time to react) |
This fixes an issue when for some reason (the fact I don't know why bothers me quite a bit) when pressing the tab bar button on the view controller that's already open and drilled down into (for example, Speakers → Particular speaker) normally iOS would pop navigation controller to the root