This example uses RxSwift observables as binding mechanism between ViewModel and ViewController.
The following image illustrates the bindings:
ViewModelinputs such as text field changes orUITableViewrow selection are defined asDrivertraitsViewModeloutputs are defined asDrivertraits
ViewModelType is a simple scaffolding for every ViewModel in this architecture and it clearly defines inputs and outputs as structs.
protocol ViewModelType {
associatedtype Input
associatedtype Output
func transform(input: Input) -> Output
}
Bindings are created when ViewController calls func transform(input: Input) -> Output function.
Clone the repository:
git clone git@github.com:tailec/ios-architecture.git
Navigate to mvvm-rxswift-pure directory:
cd mvvm-rxswift-pure
Install dependencies:
pod install
