iPhone Duo SwiftUI examples

Explore SwiftUI APIs, components, and modifiers on iPhone Duo. Compare portrait and landscape layouts in closed, partially open, and fully open states, with Swift code and Apple documentation.

GeometryReader

Reserved Regions

Returns the reserved regions for the given kind. A reserved region indicates that an area within a view’s coordinate space has been claimed by something the view does not own

Explore Reserved Regions on iPhone Duo in portrait and landscape across closed, partially open, and fully open states, with SwiftUI code and Apple API documentation.

var body: some View {
    GeometryReader { proxy in
        ZStack(alignment: .topLeading) {
            ForEach(proxy.reservedRegions(kind: .division)) { region in
                regionView(region, color: .blue)
            }

            ForEach(proxy.reservedRegions(kind: .occlusion)) { region in
                regionView(region, color: .orange)
            }
        }
    }
}

private func regionView(_ region: ReservedRegion, color: Color) -> some View {
    Rectangle()
        .fill(color)
        .frame(width: region.frame.width, height: region.frame.height)
        .offset(x: region.frame.minX, y: region.frame.minY)
}
iOS 27.1+ iPadOS 27.1+

Every available iPhone Duo screenshot for Reserved Regions.

6 views