Post

Replies

Boosts

Views

Activity

Reply to Managing UISplitViewController displayMode with orientation change & multitasking in iOS 14?
For any future readers: I figured out that it's important to set BOTH .preferredDisplayMode and .preferredSplitBehavior when the view transitions. Setting just one or the other will result in lots of weird behavior. What I figured out works for this case is setting preferredDisplayMode = .twoBesideSecondary and preferredSplitBehavior = .tile when the screen is wide enough to fit all 3 columns, and when it is not, set preferredDisplayMode = .oneBesideSecondary and preferredSplitBehavior = .displace. I used a function that checks if the view.frame.size.width < 1194 to determine if the screen is full width or not, as using orientation only would cause problems if the app is side by side with another. I'll probably tweak that value over time so don't take it as gospel, but it works for now. I call this function in viewDidLoad for initially setting the behaviors, then again in viewWillTransition(toSize:), using the size property there to update the behaviors.
Jul ’20
Reply to UISplitViewController Examples
Not official, but I found this awesome sample project on GitHub: https://github.com/marcosatanaka/sidebar-ios14 It's very basic but gives a good idea of how to generally setup a UISplitViewController as root view and implement a Sidebar. It also gives some sample code for the new ways of setting up UICollectionViewCellRegistration and section snapshots with DiffableDataSource!
Jul ’20