Skip to content

Instantly share code, notes, and snippets.

@aheze
Created July 4, 2020 23:28
Show Gist options
  • Save aheze/7311fc90d89903dbe93f17b6bb9cfe31 to your computer and use it in GitHub Desktop.
Save aheze/7311fc90d89903dbe93f17b6bb9cfe31 to your computer and use it in GitHub Desktop.
/// we can make the modifier more Swifter by wrapping it in a method...
/// ... then making the method an extension of View, so we can easily add it to any SwiftUI view
public extension View {
func onTouchDownUpEvent(changeState: @escaping (ButtonState) -> Void) -> some View {
modifier(TouchDownUpEventModifier(changeState: changeState))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment