Tap Action not working when Color is clear SwiftUI

The accurate way is to use .contentShape(Rectangle()) on the view.
Described in this tutorial:

control-the-tappable-area-of-a-view by Paul Hudson @twostraws

VStack {
    Image("Some Image").resizable().frame(width: 50, height: 50)
    Spacer().frame(height: 50)
    Text("Some Text")
}
.contentShape(Rectangle())
.onTapGesture {
    print("Do Something")
}

how-to-control-the-tappable-area-of-a-view-using-contentshape stackoverflow

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)