Unlock This Episode
Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.
We can make all of this much better if we finally take control over our dependency on the file system. In particular, the saving and loading of data to the file system.
Our Dependencies library does not come with such a client immediately available to us, but it is quite easy to create. This will give us a chance to show off how one registers a new dependency with the library so that it is immediately available everywhere via the
@Dependency property wrapper.
@Dependency(\.speechClient.authorizationStatus)in the standup detail view to show
alert when authorization has been denied.
Further, add an alert button action that uses
@Dependency(\.openURL)to go to the
application notification settings.
@Dependency(\.uuid)to take control of all instances of
UUID()in the application.
Write a test for the record screen that confirms that the timer pauses when the end meeting
alert is presented. Use a test clock to show that when the alert is up, the
state does not change when the clock is advanced. Dismiss the alert, advance the clock, and
assert that the timer continues.
Write a test for the deletion flow of a standup. Start the test off in a state with at least
one standup, and simulate drilling down to the detail, tapping the delete button, assert
that an alert was shown, simulate tapping the confirm deletion button, and then assert that
the screen popped back to the root and the standup was removed from the collection.
Let’s beef up the static
DataManager.mockmethod to support accessing data from more than
one URL in a test. Instead of wrapping a mutable blob of
Data, wrap a
Let’s further beef up the
DataManagerdependency. Define a static
XCTFailby default. Then, define
overridemethods that bypasses failure on a per-URL
Learn the essentials of iOS app development by building a fully functional app using SwiftUI.
Custom Dump is one of our open source projects. It provides a collection of tools for debugging, diffing, and testing your application’s data structures.
A library we open sourced. Tools for making SwiftUI navigation simpler, more ergonomic and more precise.
An open source library that provides schedulers for making Combine more testable and more versatile.
CasePaths is one of our open source projects for bringing the power and ergonomics of key paths to enums.
An open source library of ours. A few clocks that make working with Swift concurrency more testable and more versatile.
An open source library of ours. A dependency management library inspired by SwiftUI’s “environment.”
Identified Collections is our open source library that provides an ergonomic, performant way to manage collections of identifiable data, and fits in perfectly with SwiftUI.
Tagged is one of our open source projects for expressing a way to distinguish otherwise indistinguishable
types at compile time.
XCTest Dynamic Overlay is a library we wrote that lets you write test helpers directly in your application and library code.
These packages are available as a package collection, usable in Xcode 13 or the Swift Package Manager 5.5.