The Point of Redacted SwiftUI: Part 2

Episode #118 • Sep 21, 2020 • Subscriber-Only

We finish building a rich onboarding experience for our application by selectively enabling and disabling pieces of logic in the app depending on what step of the onboarding process we are on. This is only possible due to the strict “separation of concerns” the Composable Architecture maintains.

Part 2
Introduction
00:05
Making onboarding interactive
01:14
Taking things even further
15:44
Transforming dependencies
17:58

Unlock This Episode

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

Introduction

With this done we have a mostly functional onboarding experience. When we step through the onboarding flow we will see that the redaction focus changes from the nav to the filters and then finally to the todo list. And each step of the way the UI does not allow any real logic to be executed. You can tap on any button and nothing happens.

But we can take this even further. What if we wanted certain parts of the application’s logic to be active while in a particular step of the onboarding process? For example, while on the actions step we could allow you to add todos, and on the filters step maybe we allow you to switch the filters, and while on the todos step we allow you to check off todos. This would enhance the user experience by allowing the user to explore certain functionality in the app while still operating within the onboarding sandbox.

To do this we are going to implement the onboarding domain as a whole new Composable Architecture feature. That means we will specify its state, actions and reducer, and use a store to drive our OnboardingView.

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 isSkipButtonHidden state to OnboardingState and have it hide the skip button when on the last step of the onboarding flow

  2. Update the onboarding reducer to allow new todos to be added when on the actions step.

  3. Generalize the onboarding analytics client by defining a method that can “tag” an analytics client with a given string:

    extension AnalyticsClient {
      func tagged(_ tag: String) -> Self {
        fatalError("unimplemented")
      }
    }
    
  4. Update the onboarding flow to automatically transition from step 1 to step 2 after adding a todo.

  5. Update the onboarding flow to automatically transition from step 2 to step 3 after changing the filter a couple times.

  6. Update the onboarding flow to automatically transition from step 3 to done after marking a few todos complete.

  7. Write some tests!

References

Separation of Concerns

“Separation of Concerns” is a design pattern that is expressed often but is a very broad guideline, and not something that can be rigorously applied.

Downloads