tailec / ios-architecture

A collection of iOS architectures - MVC, MVVM, MVVM+RxSwift, VIPER, RIBs and many others
MIT License
1.51k stars 188 forks source link

Question: ViewModel transform(input:) -> SearchViewModel.Output #5

Closed amadeu01 closed 5 years ago

amadeu01 commented 5 years ago

Could you explain more about this implementation.

func transform(input: SearchViewModel.Input) -> SearchViewModel.Output {

I could not understand well. The ViewModel is some sort of pipeline that for an input it generates one output?

tailec commented 5 years ago

Yeah exactly.

It's just a way of describing bindings between VM and VC without using Subjects. Bear in mind, a view model with ViewModelType protocol will only work with view controllers that are able to create all inputs at the same time (usually in viewDidLoad lifecycle method).