Swiftpack.co - Package - 0xLeif/SUIObject

SUIObject

Example

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() ?? "")+"
                })
            }
        }
    }
}

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

Combino+ - 2020-09-11 00:40:03

This release has switched to using Combino instead of Later

Combino - 2020-09-11 00:29:24

This release has switched to using Combino instead of Later

SUIObject - SUI - 2020-09-10 02:02:58

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() ?? "")+"
                })
            }
        }
    }
}

@ObservedObject SwiftUI - 2020-09-09 15:53:08

Observe Object

import SwiftUI
import SUIObject

struct ContentView: View {
    @ObservedObject var object = SUIObject("...")
    
    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() ?? "")+"
                })
            }
        }
    }
}