Skip to main content

Command Palette

Search for a command to run...

SwiftUI: Disable a view receiving taps

Published
โ€ข1 min read

Use .allowsHitTesting(false) on the view. This configures whether the view will accept hit test operations.

Apple Docs

Circle()
    .frame(width: 200, height: 200)
    .allowsHitTesting(false)