Beginning iOS Unit and UI Testing - Part 3: Async and | Ray Wenderlich

In this video tutorial on unit and UI testing in iOS, you’ll learn how to write unit tests for your asynchronous code and create mock objects in Swift.

This is a companion discussion topic for the original entry at

I’ve discovered a couple of errors in the challenge solution documentation. In the class MockCloudNetworkService, the class should inherit from CloudNetworkManager, not CloudNetworkService, and the public methods login and loadPancakeHouses should be overridden:

public class MockCloudNetworkService: CloudNetworkManager {
    public lazy var pancakeHouses: [PancakeHouse] = {
        let bundle = Bundle(for: type(of: self))
        let path = bundle.path(forResource: "test_pancake_houses", ofType: "plist")!
        let array = NSArray(contentsOfFile: path)
        return PancakeHouse.from(array as! [[String : Any]])

    public override func login(userName: String, password: String,
                      success: () -> (),
                      failure: (Error) -> ()) {

    public override func loadPancakeHouses(success: @escaping ([PancakeHouse]) -> (),
                                  failure: @escaping (CloudNetworkError) -> ()) {

hope this helps anyone who might get stuck

@jrg.developer wondering where to get the original project file as I want to follow the steps with this video?