some
This commit is contained in:
1 parent
7096f722d2
commit
ad4fb381ee
3 files changed
+50
No files matched your search
@@ -0,0 +1,24 @@
|
|||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct RootView: View {
|
||||||
|
@ObservedObject var vm: RootVM
|
||||||
|
|
||||||
|
init(_ vm: RootVM) {
|
||||||
|
self.vm = vm
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(spacing: 16) {
|
||||||
|
Text("Hello, World!")
|
||||||
|
.font(.largeTitle)
|
||||||
|
|
||||||
|
Text(vm.countText)
|
||||||
|
.font(.title3.monospacedDigit())
|
||||||
|
|
||||||
|
Button("Increment") {
|
||||||
|
rootSet(F.didClickIncrement, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(40)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
class RootComponent {
|
||||||
|
let ctrl = DialectController(RootContext())
|
||||||
|
static private(set) weak var singleton: RootComponent?
|
||||||
|
|
||||||
|
init() {
|
||||||
|
Self.singleton = self
|
||||||
|
rootRegisterEffects(ctrl)
|
||||||
|
rootRegisterShoulds(ctrl)
|
||||||
|
otherSetupConsoleLogging(ctrl, "Root")
|
||||||
|
}
|
||||||
|
|
||||||
|
func setup() {
|
||||||
|
rootSet(F.didSetup, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import Combine
|
||||||
|
|
||||||
|
final class RootVM: ObservableObject {
|
||||||
|
@Published var countText = ""
|
||||||
|
|
||||||
|
static private(set) weak var shared: RootVM?
|
||||||
|
|
||||||
|
init() {
|
||||||
|
Self.shared = self
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user