onInteractiveResizeChange
Adds an action to perform when the enclosing window is being interactively resized.
View ModifieriOS 26.0+macOS 26.0+tvOS 26.0+watchOS 26.0+visionOS 26.0+onInteractiveResizeChange(_:) in SwiftUI
Declaration
compose().onInteractiveResizeChange(
action: (isResizing: boolean) => void
)nonisolated func onInteractiveResizeChange(
_ action: @escaping (Bool) -> Void
) -> some ViewParameters
action*(isResizing: boolean) => voidA closure to run when the state of the window's interactive resize changes.
Discussion
Use this modifier to adjust how your view behaves when a window is in the process of being resized by the user. The action provided to this modifier will be called when the resize action begins and ends.
For example, you can adjust the frame rate of a custom Metal renderer during interactive resize:
struct RootView: View {
var renderer: MetalRenderer
var body: some View {
MetalRepresentable(renderer: renderer)
.onInteractiveResizeChange { isResizing in
// Let the renderer know the window is being actively
// resized, so that it can adjust frame rate,
// pause animations, etc.
renderer.handleWindowResize(isResizing: isResizing)
}
}
}See also
More in Events and lifecycle.
- onAppearAdds an action to perform before this view appears.
- onChangeAdds a modifier for this view that fires an action when a specific value changes.
- onContinueUserActivityRegisters a handler to invoke in response to a user activity that your app receives.
- onContinuousHoverAdds an action to perform when the pointer enters, moves within, and exits the view's bounds.
- onDisappearAdds an action to perform after this view disappears.
- onDragActivates this view as the source of a drag and drop operation.
- onDragSessionUpdatedSpecifies an action to perform on each update of an ongoing dragging operation activated by draggable(:) or anther drag modifiers.
- onDropDefines the destination of a drag and drop operation that handles the dropped content with a closure that you specify.
- onDropSessionUpdatedSpecifies an action to perform on each update of an ongoing drop operation activated by dropDestination(:) or other drop modifiers.
- onGeometryChangeAdds an action to be performed when a value, created from a geometry proxy, changes.
- onHingeChangeAdds an action to perform when the hinge context of the view hierarchy changes.
- onHoverAdds an action to perform when the user moves the pointer over or away from the view's frame.