Contents

allowsWindowActivationEvents()

Configures gestures in this view hierarchy to handle events that activate the containing window.

Declaration

nonisolated func allowsWindowActivationEvents() -> some View

Discussion

Views higher in the hierarchy can override the value you set on this view. In the following example, the tap gesture on the Rectangle won’t handle events that activate the containing window because the outer allowsWindowActivationEvents(_:) view modifier overrides the inner one:

HStack {
    Rectangle()
        .onTapGesture { ... }
        .allowsWindowActivationEvents()
}
.allowsWindowActivationEvents(false)