My understanding of SwiftUI
- The main advantage of SwiftUI over UIKit is to write both your initial UI rendering as well as any updates to your UI in one go.
- On a very abstract level, this is similar to TEA, but practically, it's quite different: updates in SwiftUI are incremental, and for many things there's no diffing necessary.
In SwiftUI, you define your views as structs that conform to
View protocol has a single requirement: you need to implement
body, a computed property that returns another type conforming to
Just like normal structs in Swift, you can use properties anywhere inside your
View. However, unlike normal structs, some properties are special. Specifically, properties that are defined using the property wrappers
State (and some others). When SwiftUI renders the body, it will subscribe to these properties. When these properties change, they send a notification, and SwiftUI will re-render the necessary parts. I call thes