Tour of the Composable Architecture: Persistence

Episode #249 • Sep 11, 2023 • Subscriber-Only

We conclude the series by adding the final bit of functionality to our application: persistence. We’ll see how adding a dependency on persistence can wreak havoc on previews and tests, and all the benefits of controlling it.

Persistence
Introduction
00:05
Speech recognition client
00:30
Data persistence
21:06
Data manager dependency
33:48
Outro
54:55

Unlock This Episode

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

Introduction

Stephen: It’s pretty cool to see just how easy it was to use Apple’s speech recognizer API in order to get a live feed of transcription data while running our meeting. And we could put all that logic in an effect so that our reducer can remain a simple function, and our state can remain a simple value type.

Brandon: Now let’s actually do something with these transcripts.

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

Exercises

  1. Add error handling for the speech recognition task. If the task fails, show the user an error with options to abandon the meeting, resume the meeting without transcription, or to retry speech transcription.

    Write tests against the failure and each resolution.

    Enhance the logic of the feature so that if they retry speech transcription, it is appended to the transcript from the task that failed rather than written over.

  2. Add error handling for when persisted data fails to load.

  3. Add error handling for when persisted data fails to save.

  4. Beef up the DataManager.mock. It is currently limited to saving and loading a single value with no regard to the URL passed in. Instead, have it hold onto a dictionary mapping URL to value so that it can emulate an entire file system.

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