Reputation: 143
Hi I am new to MVVM as well as to iOS programming. I am trying to convert my sample app into MVVM pattern. Here is my simple use case-
I have one view controller class which holds information screen - InfoViewController. I has 4 informative labels with some text. Currently it is implementated in MVC pattern. viewDidLoad method binds iboutlets with text which is static. How can I convert this into MVVM? Here is my understanding
Currently this text is static but it may come from web service in future so should I create model class here?
Is this correct way for this use case?
Upvotes: 2
Views: 1109
Reputation: 586
The best way to bind your view and view model is to include a framework that supports you.
E.g:
https://github.com/ReactiveX/RxSwift
https://github.com/ReactiveKit/ReactiveKit
I use RxSwift to bind my view model to the view. A nice introduction to mvvvm with rx can be found at https://academy.realm.io/posts/slug-max-alexander-mvvm-rxswift
Upvotes: 2