SwiftUI Tap Anywhere
Today I learned how to implement tap anywhere to dismiss the keyboard on SwiftUI.
In your parent stack, either VStack
or HStack
, add the following code.
|
|
The most important thing to take note here is the contentShape modifier or tap gesture will not work.