Recommended SwiftUI API for observing fold posture on iPhone Duo

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.

Answered by DTS Engineer in 906658022

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:

  1. Use a GeometryReader to access a GeometryProxy instance.
  2. Call reservedRegions(kind:options:layoutDirectionBehavior:) to retrieve an array of ReservedRegion structures.
  3. Inspect active .divisions or .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

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:

  1. Use a GeometryReader to access a GeometryProxy instance.
  2. Call reservedRegions(kind:options:layoutDirectionBehavior:) to retrieve an array of ReservedRegion structures.
  3. Inspect active .divisions or .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

Recommended SwiftUI API for observing fold posture on iPhone Duo
 
 
Q