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

projectedValue

A projection of the state object that creates bindings to its properties.

Declaration 宣言

var projectedValue: ObservedObject<ObjectType>.Wrapper { get }

Discussion 議論

Use the projected value to pass a binding value down a view hierarchy. 投影値を使って、バインディング値をビュー階層に通達してください。 To get the projected value, prefix the property variable with $. For example, you can get a binding to a model’s isEnabled Boolean so that a Toggle view can control the value:


struct MyView: View {
    @StateObject var model = DataModel()


    var body: some View {
        Toggle("Enabled", isOn: $model.isEnabled)
    }
}

See Also 参照

Getting the Value 値を取得する