Starting on iPadOS 16.4 I noticed a new and unexpected behavior on iPad.
Configuration:
- Tested on both iPad simulator and iPad real device with iPadOS 16.4
- The app's window root view controller is set to
UISplitViewController - The
UISplitViewControllerdelegate is being used to detect when it collapses and expands.
Scenario:
- Run the app
- Exit the app -
applicationDidEnterBackgroundis fired splitViewController:collapseSecondaryViewController:ontoPrimaryViewController:is fired. Printing thetraitsCollectionof the main app's window shows thathorizontalSizeClassis nowCompact.(It wasRegularbefore app was closed)- Immediately after that,
splitViewController:separateSecondaryViewControllerFromPrimaryViewController:is fired. Printing thetraitsCollectionof the main app's window shows thathorizontalSizeClassisRegular.
On both steps #3 and #4, the stack trace shows that a snapshot is being executed.
Before iPadOS16.4, exiting the app didn't trigger the collapse/expand delegate methods.
It worth indicating that the horizontalSizeClass is eventually restored to the original value (of Regular) after step #4, so in most cases, this behavior shouldn't cause any issues. However, this "dancing" behavior where the horizontalSizeClass changes from regular to compact and back to regular, has some side effects in my use case.
I am not sure if this behavior is intended and by design, or its a bug.
Does anyone familiar with this?