Created
July 26, 2023 10:40
-
-
Save yannxou/5f398700e619684b42ddbae4815c7ba0 to your computer and use it in GitHub Desktop.
SwiftUI onTapGesture modifier async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension View { | |
func onTapGesture(perform action: () async -> Void) -> some View { | |
self.onTapGesture { | |
Task { await action() } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment