The hinge angle is available, and it is tempting to build layout on it. Apple’s guidance is specific: hinge data is for interactions and effects only. Use the arrangement and region layout APIs for layout decisions.
The API
struct InstrumentView: View {
@State private var pitchBend: Double = 0
var body: some View {
GuitarView(pitchBend: pitchBend)
.onHingeChange { _, context in
if let hinge = context.hinge, hinge.status == .partiallyOpen {
pitchBend = calculatePitchBend(angle: hinge.angle)
} else {
pitchBend = 0
}
}
}
}
UIKit has UIHingeInteraction for the same purpose.
Note the null check. context.hinge is nil on a device without a hinge, and the same code runs on every other iPhone — so handle the nil case as the normal path, not an error.
The hinge reports three states: closed, partially open, and fully open.
Why layout is different
Angle is continuous and noisy. A layout driven by it recomputes constantly as the user’s grip shifts, which reads as jitter. Division regions, by contrast, are discrete and stable: active or not, with a defined frame. That is what layout wants.
Use the angle for what it is uniquely good at — a continuous input for an effect, an instrument, a parallax, a game control.
How to verify
Move the hinge slowly through its full range. Any effect should track smoothly, and the layout underneath should not move at all except at the discrete points where a division region becomes active or inactive.