allowsHitTesting

Configures whether this view participates in hit test operations.

View ModifieriOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+allowsHitTesting(_:) in SwiftUI

Declaration

React
compose().allowsHitTesting(enabled: boolean)
Swift
nonisolated func allowsHitTesting(_ enabled: Bool) -> some View

Parameters

  • enabled*boolean

Discussion

Specify true to indicate this view participates in hit testing for a method such as NSHostingView.hitTest(_:) to determine whether a point is inside a view. Otherwise specify false.

For more information, see doc://com.apple.documentation/documentation/appkit/nsview/hittest(_:).

See also

More in Input and interaction.