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

projectedValue

A binding to the state value. 状態値へのバインディング。

Declaration 宣言

var projectedValue: Binding<Value> { get }

Discussion 議論

Use the projected value to pass a binding value down a view hierarchy. 投影値を使って、バインディング値をビュー階層に通達してください。 To get the projectedValue, prefix the property variable with a dollar sign ($). In the following example, PlayerView projects a binding of the state property isPlaying to the PlayButton view using $isPlaying:


struct PlayerView: View {
    var episode: Episode
    @State private var isPlaying: Bool = false


    var body: some View {
        VStack {
            Text(episode.title)
                .foregroundStyle(isPlaying ? .primary : .secondary)
            PlayButton(isPlaying: $isPlaying)
        }
    }
}

See Also 参照

Getting the Value 値を取得する