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.

View

Hinge State

A type encapsulating the state of a single hinge.

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

@State private var hinge: DeviceHinge? = nil

var body: some View {
    VStack {
        if let hinge {
            Text("Status \(hinge.status)")
            Text("Angle \(hinge.angle.degrees, specifier: "%.0f")°")
        } else {
            ContentUnavailableView(
                "Hinge Unavailable",
                systemImage: "rectangle.split.2x1"
            )
        }
    }
    .onHingeChange { _, newContext in
        hinge = newContext.hinge
    }
}
iOS 27.1+ iPadOS 27.1+

Every available iPhone Duo screenshot for Hinge State.

6 views