I'm developing an iPadOS 18+ application that uses a UITabBarController, styled as a sidebar, to serve as the primary navigation interface. This setup includes 20 different tabs, each representing a distinct section of the app.
For the user experience, each tab needs to present a master-detail interface, implemented using a UISplitViewController. The goal is to allow users to navigate between tabs via the sidebar, and within each tab, access related content through the split view's list-detail pattern.
The Problem:
Currently, my implementation involves instantiating a separate UISplitViewController for each tab, resulting in 20 unique split view instances embedded inside the UITabBarController. While this works functionally, it leads to significant memory usage, especially after the user opens each tab at least once. The accumulation of all these instantiated view controllers in memory eventually causes performance degradation or even memory warnings/crashes on lower-end iPads.
The Question:
What is the best approach to implement this type of architecture without running into memory management issues?
Specifically:
-
Is there a way to reuse or lazily load the
UISplitViewController
instances only when needed? -
Can we unload or release split view controllers that haven't been used for a while to reduce memory pressure?
-
Would a custom container controller be more appropriate than using
UITabBarController
in this case? -
Are there iPadOS 18+ best practices or newer APIs that support this kind of complex multi-tab, multi-split-view structure efficiently?
Any advice on how to optimize memory usage while preserving the sidebar navigation and split view layout would be highly appreciated.