This example uses RxSwift observables as binding mechanism between ViewModel
and ViewController
.
The following image illustrates the bindings:
ViewModel
inputs such as text field changes orUITableView
row selection are defined asDriver
traitsViewModel
outputs are defined asDriver
traits
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 [email protected]:tailec/ios-architecture.git
Navigate to mvvm-rxswift-pure
directory:
cd mvvm-rxswift-pure
Install dependencies:
pod install