Data Flow Through SwiftUI
pdf
inspiration
- data change -> view change, => update view
- you should have a Single Source of Truth.
Duplicated Source of Truth can lead to bug and inconsistency
=> lift up the data into a common ancestor and let the two children have a reference to it.
=> eliminating inconsistency bug between view and your data. And you can use the tool available in the language to enforcing variant in your data .
view와 data사이의 불일치에 의한 bug를 제거할 수 있고, tool을 사용해 data를 바꿀 수 있다.
Property
what
when
@Environment
@Binding
@State
BindableObject