This is a sample project demonstrating how to implement the new Sidebar UI on an iPad app using Swift. It tries to mimic the UI of the new Music app on iPadOS 14.0:
It contains just the code required to create the UI, and it was based on the Apple's sample project Implementing Modern Collection Views.
- Maintain the selection when contracting/expanding a section.
- Restore the state of a view controller when changing between regular and compact mode.
- Revert to tab bar based navigation on compact layouts, and on the iPhone.
Starting the app in compact mode, and then changing it to regular mode causes the following error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected view controller change in Secondary column for expanding <UISplitViewController: 0x10550a630>'
I have a question for this on the Apple Developer Forums, I'm not sure if this is a bug in the API, or if I'm using it incorrectly.