Skip to content

Commit

Permalink
Re-enable TokamakDemo with StackReconciler
Browse files Browse the repository at this point in the history
  • Loading branch information
carson-katri committed May 23, 2022
1 parent 33f0e67 commit 104f14f
Showing 1 changed file with 18 additions and 40 deletions.
58 changes: 18 additions & 40 deletions Sources/TokamakDemo/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

0 comments on commit 104f14f

Please sign in to comment.