vinhnx/notes

SwiftUI + Combine note

vinhnx opened this issue ยท 2 comments

References: (note to self, add new articles on the top)

SDK diffs:

==
since SwiftUI is value type
everytime you use reference type, use @ObjectBinding

@State

  • view local
  • value type
  • framework managed

BindableObject:

  • external
  • reference type
  • developer managed

@EnvironmentObject > @ObjectBinding
[use EnvironmentObject to pass data around view hierarchy indirectly
while ObjectBinding just to pass from superview to nearest child view (subsequently)]

@State > @binding

super View should have @State
child View should have @binding
superView @State [pass]-> childView @binding

reference: https://developer.apple.com/wwdc19/226

--

TIL: SwiftUI List and ForEach reuse cell internally

https://twitter.com/jckarter/status/1143704650215858177?s=20

--

SwiftUI together with Combine will change everything we knew about iOS/macOS/tvOS/watchOS or whateverOS development