Skip to content

Instantly share code, notes, and snippets.

@vikingosegundo
Last active October 29, 2021 01:27
Show Gist options
  • Save vikingosegundo/01cf7790104cd582ef8cee63a526bcd9 to your computer and use it in GitHub Desktop.
Save vikingosegundo/01cf7790104cd582ef8cee63a526bcd9 to your computer and use it in GitHub Desktop.
import SwiftUI
@main
struct SnakeApp:App {
var body:some Scene {
WindowGroup {
ZStack {
Color.black
.edgesIgnoringSafeArea(.all)
ContentView(state:ViewState(
game:createGame(size: (90,50))),
pixelFactor:5.0)
}
}
}
}
final class ViewState:ObservableObject {
@Published var game:Game
@Published var target:Coordinate?
init(game g:Game) {
game = g
game.register { self.game = g }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment