A gesture that recognizes a magnification motion and tracks the amount of
magnification.
A magnify gesture tracks how a magnification event sequence changes.
To recognize a magnify gesture on a view, create and configure the
gesture, and then add it to the view using the
``View/gesture(_:including:)`` modifier.
Add a magnify gesture to a ``Circle`` that changes its size while the
user performs the gesture:
struct MagnifyGestureView: View {
@GestureState private var magnifyBy = 1.0
var magnification: some Gesture {
MagnifyGesture()
.updating($magnifyBy) { value, gestureState, transaction in
gestureState = value.magnification
}
}
var body: some View {
Circle()
.frame(width: 100, height: 100)
.scaleEffect(magnifyBy)
.gesture(magnification)
}
}
Creates a magnify gesture with a given minimum delta for the gesture
to start, and the input kinds the gesture recognizes.
- Parameters:
- minimumScaleDelta: The minimum scale delta required before the
gesture starts.
- inputKinds: A set of input kinds that this gesture recognizes.
If not specified, the gesture will recognize all applicable input
kinds that a person can use to perform it.
get · iOS 17.0+
minimumScaleDelta
TypeScript
get minimumScaleDelta(): number
Swift declaration
var minimumScaleDelta: CGFloat
The minimum required delta before the gesture starts.
set · iOS 17.0+
minimumScaleDelta
TypeScript
set minimumScaleDelta(value: number)
Swift declaration
var minimumScaleDelta: CGFloat
The minimum required delta before the gesture starts.
Creates a magnify gesture with a given minimum delta for the
gesture to start.
- Parameter minimumScaleDelta: The minimum scale delta required before
the gesture starts.