State management has become a very popular concern lately in mobile applications. The idea of a state that should be the single source of truth within an application is quite attractive ! The views would only be a displayable artefact of this state 👌.
There are plenty of posts about doing a network layer in a type safe way with Swift. No matter the used network API, those approaches all rely on returning a data type that is precisely what we expect. In this post we will try to go a little bit further by strongly coupling the endpoint we want to fetch and the data type we are expecting.
Swift 4.1 is available since a few days now and it comes with an interesting feature - Conditional conformance. This is a new tool for achieving Protocol Oriented Programming as well as API designing. This post is a quick take on this brand new technic and will be followed for sure by deep dive posts in a few weeks.