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.
In this tutorial, we'll look at a case study of using conditional conformance in unit tests. The problem we'll be solving is a common one. You have a set of stubbed JSON responses and you want to test that they are serialized correctly into Swift model types. Some responses return a single model resource while others return a collection.
In the last tutorial, we built a cross-platform Swift framework. If you want to reuse your frameworks in other projects, the next step is to support dependency managers. The three most popular right now are CocoaPods, Carthage, and Apple's Swift Package Manager.
With technologies like handoff and continuity, a unified developer program, and many of the same system frameworks available on all four of its platforms, Apple has been moving over the past few years to more seamlessly integrate its ecosystem of devices. This presents a great opportunity for us to bring our apps to each platform while reusing a lot of the app logic we've already written.