wrappedValue
The underlying value that the observed object references.
Declaration
@MainActor @preconcurrency var wrappedValue: ObjectTypeDiscussion
The wrapped value property provides primary access to the observed object’s data. However, you don’t typically access it by name. Instead, SwiftUI accesses this property for you when you refer to the variable that you create with the @ObservedObject attribute.
struct MySubView: View {
@ObservedObject var model: DataModel
var body: some View {
Text(model.name) // Reads name from model's wrapped value.
}
}When you change a wrapped value, you can access the new value immediately. However, SwiftUI updates views that display the value asynchronously, so the interface might not update immediately.