Persistent reusable container for item collections in Swift

Let's build a container where we can store collections of items conforming to a protocol. All the collections are identified by a case in enum. For making the container reusable, we'll use protocols as requirements on keys and items in collections. Moreover, the container should be archivable and unarchivable. Creating a reusable container Container's implementation …

Testing networking code with custom URLProtocol on iOS

Testing networking code might sound tricky at first but in reality, it just means using custom URLProtocol what returns data we would like to. This allows testing the networking module without mocking URLSession. Using this approach we could do so much more, even integrating a third party networking library. Networking class wrapping URLSession Firstly, let's …