commit
7712d2eb78
|
@ -6,10 +6,10 @@ import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "ObjectUI",
|
name: "ObjectUI",
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v13),
|
.iOS(.v14),
|
||||||
.macOS(.v10_15),
|
.macOS(.v11),
|
||||||
.watchOS(.v6),
|
.watchOS(.v7),
|
||||||
.tvOS(.v13)
|
.tvOS(.v14)
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
public struct ObjectView<Content>: View where Content: View {
|
public struct ObjectView<Content>: View where Content: View {
|
||||||
@ObservedObject private var object: Object
|
@StateObject private var object: Object = Object()
|
||||||
|
|
||||||
private var content: (Object) -> Content
|
private var content: (Object) -> Content
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ public struct ObjectView<Content>: View where Content: View {
|
||||||
data: Any? = nil,
|
data: Any? = nil,
|
||||||
content: @escaping (Object) -> Content
|
content: @escaping (Object) -> Content
|
||||||
) {
|
) {
|
||||||
self.object = Object(data)
|
|
||||||
self.content = content
|
self.content = content
|
||||||
|
self.object.consume(Object(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
|
|
Loading…
Reference in New Issue