34 lines
882 B
Swift
34 lines
882 B
Swift
import SwiftUI
|
|
|
|
@main
|
|
struct ChessPenguinApp: App {
|
|
@StateObject private var model = AppModel()
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
.environmentObject(model)
|
|
.preferredColorScheme(.dark)
|
|
.tint(Theme.primary)
|
|
}
|
|
}
|
|
}
|
|
|
|
private struct RootView: View {
|
|
@EnvironmentObject private var model: AppModel
|
|
|
|
var body: some View {
|
|
NavigationStack(path: $model.path) {
|
|
DatabasesView()
|
|
.navigationDestination(for: AppRoute.self) { route in
|
|
switch route {
|
|
case .games:
|
|
GamesView()
|
|
case .game(let place):
|
|
GameView(startPlace: place)
|
|
}
|
|
}
|
|
}
|
|
.background(Theme.background.ignoresSafeArea())
|
|
}
|
|
}
|