Switch to StateObject
This commit is contained in:
parent
906eb2554e
commit
52c7e944d8
|
@ -8,7 +8,7 @@
|
|||
import SwiftUI
|
||||
|
||||
public struct ObjectView<Content>: View where Content: View {
|
||||
@ObservedObject private var object: Object
|
||||
@StateObject private var object: Object = Object()
|
||||
|
||||
private var content: (Object) -> Content
|
||||
|
||||
|
@ -16,8 +16,8 @@ public struct ObjectView<Content>: View where Content: View {
|
|||
data: Any? = nil,
|
||||
content: @escaping (Object) -> Content
|
||||
) {
|
||||
self.object = Object(data)
|
||||
self.content = content
|
||||
self.object.consume(Object(data))
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
|
|
Loading…
Reference in New Issue