The View Controller subclasses are by default complex, hard to test and hard to read classes. In this talk we will define techniques we can use to implement our view controller simpler, testable and clean
changes Server side events Change model Send URL requests Show user feedback Change system state The VC needs to be aware of what is happening The VC needs to know what to do
View • The VC should know what to show but no how • The View implements all the details of the interface (hierarchy, layout, animations, ….) View Controller View User interaction User feedback
for a Fake View • The Fake View is synchronous • Use the delegate of the view to simulate events from user • Use the Fake View to spy the VC orders • Analyse View Models VC creates View Controller View
more information • Find an extended article on how to separate View and VC at jpellat.com • Also find an article on how to test VC • Find an implemented example on my github @jpellat
how we obtain objects • The Datasource are used to obtain and save objects • DataSource interface should allow operations to be asynchronous • You should have different datasources for different kind of objects that can be stored/saved View Controller Data Source obtain objects Save objects
from local storages • The Services are interfaces that defines the API of our servers DATASOURCES IMPLEMENTATION • The Datasources components should not work on main thread • DS decides how to retrieve the data, the components implement it
for testing • Test that it is obtaining the data from the source you expect depending on the conditions • You can test your storages by saving and retrieving objects and compare they • You can do integration tests with your API for services but can be a blocker on continuous integration :(