Modern SwiftUI: Effects, Part 2

Episode #218 • Jan 2, 2023 • Subscriber-Only

We wrap up the “record meeting” screen by implementing two more side effects: speech recognition, and persistence. We’ll experience the pitfalls of interacting directly with these dependencies, and why we should care about controlling them.

Effects, Part 2
Introduction
00:05
Speech recognition
00:43
Persistence
16:50
Next time: uncontrolled dependencies
22:58

Unlock This Episode

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

Introduction

We have now built all the behavior for the timer, and it turned out to be pretty complex! We had to create new ways for the child to communicate back to the parent, and we had to implement behavior to pause the timer whenever an alert is shown, and it was pretty cool to see how we were able to accomplish these features.

OK, we are finally ready to attack the speech recognition functionality.

We are going to do the absolute bare minimum of work to implement this behavior by cramming Speech framework code directly into our model. Longtime viewers of Point-Free will see the problems with this right away, but we want to show this approach as it is how Apple’s Scrumdinger was built, and it will make it easier to see the drawbacks.

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. Display an alert if the speech recognizer throws an error.

  2. Display an alert before starting a meeting if they have previously denied speech authorization. Ask if they would like to proceed, or if they’d like to go to Settings to authorize.

  3. Update the previous logic so that the alert is only displayed the first time, or add a button that says “Stop reminding me”.

  4. Display an alert if JSON decoding fails when the model is initialized.

  5. Use a dedicated queue to load and persist standup data.

References

Getting started with Scrumdinger

Apple

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

Downloads