Skip to content

Instantly share code, notes, and snippets.

@vikingosegundo
Last active October 29, 2021 18:16
Show Gist options
  • Save vikingosegundo/632a550192dde7492281ffcc0be53c0a to your computer and use it in GitHub Desktop.
Save vikingosegundo/632a550192dde7492281ffcc0be53c0a to your computer and use it in GitHub Desktop.
struct SnakeButton:View {
@StateObject var state:ViewState
let title:String
let strokeColor:Color
let backgroundColor:Color
let callback: ()->()
var game: SnakeGame.Game { state.game }
var body: some View {
VStack {
Button { callback() }
label: { Text(title)
.frame(width:100, height:100)
.tint(.white)
.background(backgroundColor)
.overlay (Circle().stroke(strokeColor, style:StrokeStyle(lineWidth:1, dash:[5.0])))
.clipShape (Circle())
.contentShape(Circle())
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment