I'm having a lot of trouble figuring out how to structure a UISplitViewController.

I want:

* A sidebar in the primary view (always)
* I want the 1st sidebar navigation item (animals) to show triple (sidebar, animal list, animal detail)
* I want the 2nd sidebar navigation item (profile) to show double (sidebar, profile view)

I see other apps doing this (GitHub for example), but I've really got no idea how they're managing it. Resources are hard to find, and most tutorials I've seen just show one or the other column styles.

I'm mostly looking for answers on how to architecture this well, but any code would also be massively appreciated!

**SceneDelegate**

```
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    guard let windowScene = (scene as? UIWindowScene) else { return }
    window = UIWindow(frame: windowScene.coordinateSpace.bounds)
    window?.windowScene = windowScene
    window?.rootViewController = ViewController(style: .tripleColumn)
    window?.makeKeyAndVisible()
}

```

**Root view controller**

```
class ViewController: UISplitViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        viewControllers = [
            SidebarViewController(),
            AnimalsViewController(),
            AnimalDetailViewController()
        ]

        // Example attempt at removing the secondary view
        setViewController(ProfileViewController(), for: .supplementary)
        setViewController(nil, for: .secondary)
        hide(.secondary)
    }
}

```

**Desired behaviour**

**Animals**
[![Triple example](https://i.stack.imgur.com/APVnI.png)](https://i.stack.imgur.com/APVnI.png)

**Profile**
[![Double](https://i.stack.imgur.com/rhwy8.png)](https://i.stack.imgur.com/rhwy8.png)

Cheers!