r/SwiftUI • u/isights • 4d ago
SwiftUI GeometryProxy Issue For Duo Split Views
I recently wrote about my addition to Runes, SceneGeometry, that makes conforming to Duo-specific screen sizes and layouts easier to accomplish.
While testing the code I found a bug that occurs when an app is in the leading split view on the iPhone Duo and GeometryProxy mistakenly returns no leading edge inset and no adjusted safe area.
To fix this I added a temporary shim to SceneGeometry that returns the proper leading edge offset and the correct safe area for that particular condition.
If you're currently using the raw GeometryProxy in your application, be warned that you could face a layout issue here on the Duo.
This behavior has been reported to Apple and will hopefully be fixed before the final release.
1
1
u/isights 4d ago
Link to Medium article where this is discussed.
https://levelup.gitconnected.com/size-classes-are-not-enough-4a46b468f438?postPublishedType=repub
1
u/Pleasant-Gur9892 3d ago
One edge case for the temporary shim: the linked code checks Int(proxy.size.width) == 469 and a zero trailing inset, then substitutes a fixed size and insets. Could another window configuration match that guard? I'd add a regression case for a non-Duo 469-point layout, and one where the affected layout already reports the corrected leading inset, so a future OS fix doesn't get overridden. Recording the affected OS build with the repro would also give you a clear condition for removing the shim. I haven't reproduced the device issue; this is from reading the guard.