Member-only story

A Networking Manager with Alamofire

Can you fully test this? YES WE CAN

Steven Curtis
5 min readJul 1, 2020
Photo by Jesse Roberts on Unsplash

I’ve previously written a network manager with the intention of testing it completely. Can I do the same using Alamofire? That is, test the requisite classes without making real network calls?

Read on to find out!

Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 11.4.1, and Swift 5.2.2

Prerequisites:

What the project is, and what it isn’t

The idea of this project is to create a usable network manager using Alamofire, and more than that actually testing the manager, in a similar way to the method I used to create a network manager using urlsession in a previous article.

That means that the View Controller accesses the Network Manager directly simply for ease of creating this tutorial (it is not about architecture!). If you want to learn more about the architecture I might use, tyr this article about MVVM-C that contains a full example — I usually choose to make the network requests from the View Model but you might choose to make these from the coordinator.

--

--

Responses (1)