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.
16elements
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.
SwiftUI code
@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
}
}Compatibility
iOS 27.1+ iPadOS 27.1+
Tags
Found an issue or have a suggestion?
All variants
Every available iPhone Duo screenshot for Hinge State.