import SwiftUI
import SUIObject
struct ContentView: View {
@ObservedObject var object = Object("...")
var body: some View {
VStack {
Text(object.stringValue() ?? "-1")
Text(object.otherText.stringValue() ?? "-2")
Button("Change") {
self.object.run(function: "change")
}
}
.onAppear {
self.object.configure { obj in
obj.add(value: "Hello World")
obj.add(variable: "otherText", value: "Another one")
obj.add(function: "change", value: { _ in
obj.variables["otherText"] = "\(obj.otherText.stringValue() ?? "")+"
})
}
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
SwiftUI ObservableObject Object
License
0xLeif/SUIObject
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
SwiftUI ObservableObject Object