Switch to StateObject

This commit is contained in:
Zach Eriksen 2021-07-26 17:45:45 -05:00
parent 906eb2554e
commit 52c7e944d8
1 changed files with 2 additions and 2 deletions

View File

@ -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 {