diff --git a/Sources/TokamakDemo/main.swift b/Sources/TokamakDemo/main.swift index 0fc00c57d..c29cbe20e 100644 --- a/Sources/TokamakDemo/main.swift +++ b/Sources/TokamakDemo/main.swift @@ -14,49 +14,27 @@ import TokamakShim -struct TestView: View { - @State private var count = 0 +@available(OSX 10.16, iOS 14.0, *) +struct CustomScene: Scene { + @Environment(\.scenePhase) private var scenePhase - var body: some View { - VStack { - Text("\(count)") - HStack { - if count > 0 { - Button("Decrement") { count -= 1 } - } - if count < 5 { - Button("Increment") { count += 1 } - } - } + var body: some Scene { + print("In CustomScene.body scenePhase is \(scenePhase)") + return WindowGroup("Tokamak Demo") { + TokamakDemoView() } } } -#if os(WASI) -let reconciler = DOMFiberRenderer("body").render(TestView()) -#endif +@available(OSX 10.16, iOS 14.0, *) +struct TokamakDemoApp: App { + var body: some Scene { + CustomScene() + } +} -// @available(OSX 10.16, iOS 14.0, *) -// struct CustomScene: Scene { -// @Environment(\.scenePhase) private var scenePhase -// -// var body: some Scene { -// print("In CustomScene.body scenePhase is \(scenePhase)") -// return WindowGroup("Tokamak Demo") { -// TokamakDemoView() -// } -// } -// } -// -// @available(OSX 10.16, iOS 14.0, *) -// struct TokamakDemoApp: App { -// var body: some Scene { -// CustomScene() -// } -// } -// -//// If @main was supported for executable Swift Packages, -//// this would match SwiftUI 100% -// if #available(OSX 10.16, iOS 14.0, *) { -// TokamakDemoApp.main() -// } +// If @main was supported for executable Swift Packages, +// this would match SwiftUI 100% +if #available(OSX 10.16, iOS 14.0, *) { + TokamakDemoApp.main() +}