gitbay/gitbayApp.swift
33 lines · 1002 bytes
1import SwiftUI
2
3@main
4struct gitbayApp: App {
5
6 @State private var session = SessionStore()
7
8 init() {
9 GitbayFonts.register()
10 }
11
12 var body: some Scene {
13 WindowGroup {
14 ContentView()
15 .environment(session)
16 .font(.gbSans(.body))
17 .tint(.gbAccent)
18 // The screenshot checkpoint forces appearance per run;
19 // simulator clones ignore the base device's setting.
20 .preferredColorScheme(Self.forcedColorScheme)
21 }
22 }
23
24 /// A clone follows whatever appearance it was created with, so the
25 /// checkpoint has to name the one it wants. Neither flag means the
26 /// app follows the system, as it does for real users.
27 private static var forcedColorScheme: ColorScheme? {
28 let args = ProcessInfo.processInfo.arguments
29 if args.contains("-gb-dark") { return .dark }
30 if args.contains("-gb-light") { return .light }
31 return nil
32 }
33}