allowsWindowActivationEvents
Configures whether gestures in this view hierarchy can handle events that activate the containing window.
Overloads
2 ways to call compose().allowsWindowActivationEvents(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().allowsWindowActivationEvents(value: boolean | null)nonisolated func allowsWindowActivationEvents(
_ value: Bool?
) -> some ViewParameters
value*boolean | nullA Boolean value that indicates whether gestures in this view hierarchy can handle events that activate the containing window. If
nil, or if the modifier is not present, the behavior will be inherited from the view’s ancestors.
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)containing window for views that allow it by default or that inherit this behavior from their ancestors. Views that explicitly already disallow this functionality can’t have it turned on.
parameter is always
trueand it never changes.
See also
More in Input and interaction.
- allowsHitTestingConfigures whether this view participates in hit test operations.
- buttonRepeatBehaviorSets whether buttons in this view should repeatedly trigger their actions on prolonged interactions.
- disabledAdds a condition that controls whether someone can interact with this view.
- handlesExternalEventsSpecifies the external events that the view's scene handles if the scene is already open.
- helpAdds help text to a view using a localized string resource that you provide.
- invalidatableContentMark the receiver as their content might be invalidated.
- keyboardShortcutAssigns a keyboard shortcut to the modified control.
- scrollClipDisabledSets whether a scroll view clips its content to its bounds.
- scrollDisabledDisables or enables scrolling in scrollable views.
- scrollDismissesKeyboardConfigures the behavior in which scrollable content interacts with the software keyboard.
- sensoryFeedbackPlays the specified feedback when the provided trigger value changes.
- userActivityAdvertises a user activity type.