Tour of the Composable Architecture: Dependencies

Episode #248 • Sep 4, 2023 • Subscriber-Only

We introduce a complex dependency to the record meeting screen: speech recognition. We will begin to integrate this dependency into our app’s logic, and show how to control it for Xcode previews and tests

Dependencies
Introduction
00:05
The speech client dependency
01:27
Testing the record meeting feature
23:07
Other ways of ending meetings
30:46
Speech recognition
41:29
Next time: Transcription
51:01

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Introduction

Stephen: This unfortunately brings us face to face with another uncontrolled dependency. We came across these in our counter app way at the beginning, and then again in the Standups app when we needed to generate UUIDs.

The reason this is happening is because previews are incapable of showing the system alert to ask you for speech recognition permission. We don’t know if this is a bug in previews, or if this is how Apple intends for it to work, but regardless the await for fetching the status simply never un-suspends, and so the code after is never executed.

This has completely destroyed our ability to iterate on this feature in previews. We are now forced to run the app in the simulator if we want to iterate on the timer functionality, or really any of its dynamic behavior besides just its simple, static design. And this is all because we are reaching out to Apple’s APIs without regard, and so by accessing uncontrolled dependencies we are allowing them to control us.

Brandon: Well, the path forward is to simply not reach out to uncontrolled dependencies. We should do a little bit of upfront work to put an interface in front of the dependency so that we can use different versions of the dependency in previews, tests and more. In this particular situation I would love if I could just tell the dependency that I don’t care about asking the user for permission. Let’s just pretend they granted us permission.

That would be great, and would completely unblock us to start using the preview again, but it’s going to take work.

This episode is for subscribers only.

Subscribe to Point-Free

Access this episode, plus all past and future episodes when you become a subscriber.

See plans and pricing

Already a subscriber? Log in

References

Composable Architecture

Brandon Williams & Stephen Celis • Monday May 4, 2020

The Composable Architecture is a library for building applications in a consistent and understandable way, with composition, testing and ergonomics in mind.

Getting started with Scrumdinger

Apple

Learn the essentials of iOS app development by building a fully functional app using SwiftUI.

Downloads