Our adaptive split layout currently pins the posture to .flat because we could not find the supported way to read the device's fold state. What is the recommended SwiftUI API for observing fold posture and hinge geometry on iPhone Duo, and does it report correctly in the simulator as well as on device? We also want to know whether the hinge region is exposed so we can keep content out of it.
Hi @omerfarukballi,
To handle hardware occlusions and the folding hinge on iPhone Duo, you can read reserved regions using a GeometryReader. Follow these steps to adapt your layout:
- Use a
GeometryReaderto access aGeometryProxyinstance. - Call
reservedRegions(kind:options:layoutDirectionBehavior:)to retrieve an array ofReservedRegionstructures. - Inspect active
.divisionsor.occlusions, such as camera cutouts or the hinge fold, and position your content accordingly.
For more information, see the post below:
How to know when active regions are changing?
https://developer.apple.com/forums/thread/847876?answerId=906445022#906445022
Cheers,
Paris X Pinkney | WWDR | DTS Engineer