Four spots placed or sized things from UIScreen.main, which is the whole
display. The app's window can be smaller than that: in Split View, and on
iPhone Duo, where it also resizes when the phone opens or closes. They now
read the window or the view instead:
- The UIKit loading spinner centers on its window and stays centered when
the window resizes. Blocking (window interaction off) is unchanged.
- Button-free mode's trailing-edge exclusion uses the gesture area's width.
- The confetti emitter spans its own view and follows it when it resizes.
- The player's swipe-to-dismiss threshold uses the view's displayScale,
the same value as before on a standard iPhone at the default zoom.
The other UIScreen.main reads (theme brightness and light/dark, the share
extension) don't affect layout and stay as they are.
Problem
Four places size or place things from
UIScreen.main, which is the whole display. The app's window can be smaller than that: in Split View on iPad, and on iPhone Duo, where the window also resizes when the phone opens or closes. Apple's iPhone Duo guidance is to stop usingUIScreen.main(it's ambiguous on a two-display device and is headed for deprecation) and read the window, the scene or the view instead.Changes
LoadingUtils: the blocking spinner centers on its window instead of the screen, with flexible margins so it stays centered when the window resizes. Blocking is unchanged (the window's interaction is turned off, as before).ButtonFreeView: the trailing-edge exclusion for swipes uses the gesture area's measured width (onGeometryChange) instead of the screen's.ConfettiView: the emitter lays itself out from its own bounds inlayoutSubviews, with implicit animations off so it doesn't slide in from its old frame.PlayerView: the swipe-to-dismiss threshold uses the view'sdisplayScaleinstead ofUIScreen.main.nativeScale. Same value on a standard iPhone at default zoom (132pt at 3x).Left as is on purpose: the theme's brightness and light/dark reads (
ThemeManager,SettingsThemesView) and the share extension, which don't affect layout.Testing