New sideBar + tabBar bug.

Hello, I was implementing the new sideBar when I encounter a very weird behaviour.

I have a UISplitView which contain a property:
var secondaryViewControllers : [UIViewController]

This splitView is composed like this:
  • a sideBarVC for the sideBar

  • a secondary VC

  • a classic tabBarVC for the compact mode

When we tap an item in the sideBar it assign a new viewController to the .secondary of the splitView, it also change the selected index of the TabBar to keep in sync. The reverse is true too, when we select an item of the tabBarVC when in .compact mode the .secondary and the sideBar are updated.
So with this we can can go from .compact mode to sidebar mode and getting the same VC selected.

So I assign the array "secondaryViewControllers" to the tabBarVC and the same array is used the displaying the VC in the .secondary section.

That's what I want the selected section of the app keep synced. In my iPhone app I can pass from portrait to landcape and the correct section will be selected. But to only the section selected should be the same, the vc itself should be the same when passing in landscape mode. Loosing the state and progress would be strange. That's why it's the same instances of the vc used for .secondary and .compact tabBarVC.

Here is where it bug, when a VC is used in the .secondary of my splitVC it's removed from my tabBarVC.

Example:
At launch I select the first section by default. Let's say I open as .compact. Instead of having 3 tabBar item I will have 3 because the first one was removing due to the fact it's used in .seconday.
If I go to landscape I can use all of them without any problem but each time I'll open a vc from the sideBar (so set the .secondary in the splitVC) this vc will be removed from the tabBar.

Is that normal ??? I could workaround by not using the same instances for .compact but it would be weird to not have the same stade in landscape and in portrait.
Passsing to landscape: a state, back to portrait: the state before I passed to landscape.


New sideBar + tabBar bug.
 
 
Q