UISplitViewController: Expanding and collapsing strategy unclear

My app currently uses a tab bar and I would like to implement a sidebar with a similar hierarchy on iPad.

In the session video, the usage of a protocol is mentioned to set the state between the view controller in the tab bar and the view controller in the sidebar. The practicality however, is a bit unclear to me; why use this strategy instead of moving the view controllers from the tab bar controller to the split view controller? Having more view controllers in memory does not seem like a good idea, especially when the app is in the background.
How do Photos and Music handle this issue considering their hierarchies are similar to their compact width counterparts?

In my testing, I have tried updating the hierarchy using the didCollapse and didExpand delegate methods but this only resulted in the following crash:
Code Block
Mutating UISplitViewController is not allowed during a delegate callback.

Additionally, the following crash may occur:
Code Block
Unexpected view controller change in Secondary column for expanding


I also tried setting the tab bar controller for both compact and secondary but this adds a navigation controller to the tab bar controller in compact width.
The lifecycle of viewcontrollers doesn't really to do it the way you're proposing (which I actually considered). You have to write the mentioned Restore protocol or perhaps you already wrote it. If you're using iPadOS maybe you already implemented multiple windows. Well, state restoration is a key concept in multiple windows and the required restoration is similar to what needs to be done when transitioning between different size class with side bars and tab bars. Hope this helps!
UISplitViewController: Expanding and collapsing strategy unclear
 
 
Q