Model-View-ViewModel with swift
Why should you use Model-View-ViewModel pattern in an Swift application? This series of posts will go through the best practises that I have learned with Model-View-ViewModel. This is covered by building a mobile client for the FriendService that was built in my first blog post: Server-side Swift, how to setup a backend. You can either set up the backend at your localhost by following the instructions in the previous post, or you can use the service I have running on Heroku.
This first part concentrates on setting up the project, Model part of the MVVM-pattern and networking with proper error handling. The second part will talk more about the ViewModel and the View of MVVM and cover data state exchanges with Data Binding pattern. The last part adds a bit more functionality with creating, updating and deleting friends.
I also write a post about unit testing ViewModel where I’ll show how you can unit test Model, ViewModel and also how to mock network layer for unit tests.