Skip to content

Instantly share code, notes, and snippets.

@yannxou
Created July 26, 2023 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yannxou/5f398700e619684b42ddbae4815c7ba0 to your computer and use it in GitHub Desktop.
Save yannxou/5f398700e619684b42ddbae4815c7ba0 to your computer and use it in GitHub Desktop.
SwiftUI onTapGesture modifier async
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