Red Davis
Red Writes Here

Red Writes Here

SwiftUI: Disable a view receiving taps

Red Davis's photo
Red Davis
·Jun 22, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

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)
 
Share this