We write asynchronous code when we know a task will take time to complete, whether because it's computationally expensive or we're making a network request. Testing this code can be difficult, especially when the asynchronous logic is internal. For example, let's say we're making a fire and forget request to load an image into an image view? We would likely make the request on a background queue and . . .
In this tutorial, we'll see how we can use protocols to make custom view subclasses more generic. The benefit is that they'll be easier to test and reuse, and our code will be easier to read and maintain.
In the last tutorial, we saw how to generate code coverage reports using the new `xccov` tool. Part of that process is using the `xcodebuild` command to build a project with code coverage enabled. We ran that command directly in Terminal, but we could also run `xcodebuild` in a Swift script. The problem is `xcodebuild` takes time, and . . .
With the release of Xcode 9.3, Apple included a new command line tool called "xccov". It can be used to view code coverage reports as JSON, which can then be used to automate code coverage workflows. In this tutorial we'll see how to generate and view code coverage reports. We'll then write a Swift script to process the report.