IOS data binding

以下資料皆來自[Ref 1],這裡僅作個人筆記整理:

Data Binding is simply the process that establishes a connection between the app UI (View Controller) and the data (Not Model, But View Model) it displays.

There are different ways of data binding:

Technique 1: Observables
Technique 2: Event Bus / Notification Center
Technique 3: FRP Technique (ReactiveCocoa / RxSwift):
Technique 4: Combine

Note:

  • Sample code can be found in [Ref 1]
  • Almost all techniques for data binding use the Publisher-Subscriber pattern.

Ref:

1) Data Binding in MVVM on iOS:
https://fitzafful.medium.com/data-binding-in-mvvm-on-ios-714eb15e3913


2) ReactiveCocoa vs RxSwift:
https://www.raywenderlich.com/1190-reactivecocoa-vs-rxswift