forked from shadowfacts/Tusker
Maybe fix crash due to VC hierarchy consistency check failing on split collapse/expand
This commit is contained in:
parent
2ccec2f4df
commit
a07b398cbe
|
@ -214,6 +214,10 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
||||||
if item == sidebar.selectedItem {
|
if item == sidebar.selectedItem {
|
||||||
itemNavStack = secondaryNavController.viewControllers
|
itemNavStack = secondaryNavController.viewControllers
|
||||||
secondaryNavController.viewControllers = []
|
secondaryNavController.viewControllers = []
|
||||||
|
// Sometimes removing a VC from the viewControllers array doesn't immediately remove it's view from the hierarchy
|
||||||
|
for vc in itemNavStack {
|
||||||
|
vc.viewIfLoaded?.removeFromSuperview()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
itemNavStack = navigationStacks[item] ?? []
|
itemNavStack = navigationStacks[item] ?? []
|
||||||
navigationStacks.removeValue(forKey: item)
|
navigationStacks.removeValue(forKey: item)
|
||||||
|
@ -339,6 +343,11 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
||||||
let viewControllersToMove = navController.viewControllers.dropFirst(skipFirst)
|
let viewControllersToMove = navController.viewControllers.dropFirst(skipFirst)
|
||||||
navController.viewControllers.removeLast(navController.viewControllers.count - skipFirst)
|
navController.viewControllers.removeLast(navController.viewControllers.count - skipFirst)
|
||||||
|
|
||||||
|
// Sometimes removing a VC from the viewControllers array doesn't immediately remove it's view from the hierarchy
|
||||||
|
for vc in viewControllersToMove {
|
||||||
|
vc.viewIfLoaded?.removeFromSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
if let prepend = prepend {
|
if let prepend = prepend {
|
||||||
navigationStacks[item] = [prepend] + viewControllersToMove
|
navigationStacks[item] = [prepend] + viewControllersToMove
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue