How can I detect when iPad multitasking (i.e. another app brought on screen, side-by-side with my app) becomes active?
I have a UISplitViewController with the following parameters set up as below:
preferredDisplayMode = .twoBesideSecondary
preferredSplitBehavior = .tile
setViewController(SidebarVC(), for: .primary)
setViewController(SuppVC(), for: .supplementary)
setViewController(SecondaryVC(), for: .secondary)
In landscape orientation, there is plenty of room for all 3 columns (.primary, .supplementary, .secondary). In portrait or when multitasking, the screen width is narrower and my 3rd column (.secondary) gets squished to a very narrow width. The horizontal size class remains regular so I can't use that to detect it. (When horizontal size class becomes compact, my UISplitViewController.compact shows and works just fine).
I'm wanting to change the UISplitViewController.displayMode property to .twoDisplaceSecondary when the screen is narrower, but the horizontal size class remains regular (i.e. when in portrait, or when another app is in multitasking). This would allow the 3rd column to be pushed off-screen (displaced) rather than squished.
A perfect example of the exact behavior I'm looking for is the Contacts app on iPad in iOS 14. It uses a triple column layout, seemingly with a displayMode of .tile. When the app is full screen in landscape, all 3 columns are displayed and there is enough room for no squishing to occur. However, if you bring another app into multitasking (thus making the Contacts app width narrower, but horizontal size class remains regular), the displayMode seems to change to .twoDisplaceSecondary, and the 3rd column is pushed off-screen rather than being squished.
I think I can manage orientation changes via viewWillTransitionToSize() method, but I haven't been able to find a delegate or other way to detect when the app is narrower, but still with a .regular horizontal size class, like the Contacts app, is seemingly able to do.
Screenshots to show what I'm referencing:

You can see that in the second screenshot, the 3rd column is displaced rather than squished when there isn't enough space.