Don't unnecessarily load views when transferring navigation stacks
This commit is contained in:
parent
c7b708e62b
commit
1b44117891
|
@ -139,8 +139,10 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
|||
// Transfer the nav stacks for all the sidebar items that map 1 <-> 1 with tabs
|
||||
for tab in [MainTabBarViewController.Tab.timelines, .notifications, .myProfile] {
|
||||
let tabNav = tabBarViewController.viewController(for: tab) as! UINavigationController
|
||||
if tabNav.isViewLoaded {
|
||||
transferNavigationStack(from: .tab(tab), to: tabNav)
|
||||
}
|
||||
}
|
||||
|
||||
// Since several sidebar items map to the single Explore tab, we only transfer the
|
||||
// navigation stack of the most-recently used one.
|
||||
|
@ -235,7 +237,8 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
|||
// For each sidebar item, transfer the existing navigation stasck from the tab bar controller to ourself.
|
||||
var exploreItem: MainSidebarViewController.Item?
|
||||
for tab in MainTabBarViewController.Tab.allCases {
|
||||
guard let tabNavController = tabBarViewController.viewController(for: tab) as? UINavigationController else { continue }
|
||||
guard let tabNavController = tabBarViewController.viewController(for: tab) as? UINavigationController,
|
||||
tabNavController.isViewLoaded else { continue }
|
||||
let tabNavigationStack = tabNavController.viewControllers
|
||||
|
||||
switch tab {
|
||||
|
|
Loading…
Reference in New Issue