Skip to content

Instantly share code, notes, and snippets.

@onevcat
Created August 19, 2019 02:08
Show Gist options
  • Save onevcat/07fabb3010a067dad7d8d168f0eac9b1 to your computer and use it in GitHub Desktop.
Save onevcat/07fabb3010a067dad7d8d168f0eac9b1 to your computer and use it in GitHub Desktop.
struct ContentView: View {
let foo: Bool = true
var body: some View {
Button(action: {
print("miao")
}) {
Text("Click Me")
}.buttonStyle(MyButtonStyle())
}
}
struct MyButtonStyle: PrimitiveButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
return configuration.label
.foregroundColor(Color.red)
.onTapGesture(count: 2) {
configuration.trigger()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment