#author("2022-11-15T13:42:03+00:00","default:src128","src128")
&tag(PropertyWrapper);
*目次 [#o1ea3b3a]
#contents
*関連ページ [#jbf0ecac]
*参考情報 [#ca4c6609]
-[[SwiftUIのデータ管理 Property Wrapper編:https://blog.personal-factory.com/2021/01/23/how-to-use-propertywrapper-in-swiftui/]]


*Property Wrapperの種類 [#l9739a89]
-@State、@Binding、@StateObject、@ObservedObjectなどデータを管理するためのProperty Wrapperがたくさん存在する


** @State [#b535e418]
-データが値型。データの更新あり。データの発生源がVIewの場合に使用。
-ボタンをタップするとその数字が増える。
#pre{{
struct StateSample: View {
    private var counter = 0
    var body: some View {
        Button(action: {
            self.counter += 1
        }, label: {
            Text("counter is \(counter)")
        })
    }
}

}}


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS