Instance Property インスタンスプロパティ

wrappedValue

The underlying value referenced by the state object.

Declaration 宣言

var wrappedValue: ObjectType { get }

Discussion 議論

The wrapped value property provides primary access to the value’s data. However, you don’t access wrappedValue directly. しかしながら、あなたはwrappedValueに直接にアクセスしません。 Instead, use the property variable created with the @StateObject attribute:


@StateObject var contact = Contact()


var body: some View {
    Text(contact.name) // Accesses contact's wrapped value.
}

When you change a property of the wrapped value, you can access the new value immediately. However, SwiftUI updates views displaying the value asynchronously, so the user interface might not update immediately.

See Also 参照

Getting the Value 値を取得する