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
.
Subscribe to Point-Free
Access this episode, plus all past and future episodes when you become a subscriber.
Already a subscriber? Log in
Exercises
Add
isSkipButtonHidden
state toOnboardingState
and have it hide the skip button when on the last step of the onboarding flowUpdate the onboarding reducer to allow new todos to be added when on the
actions
step.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") } }
Update the onboarding flow to automatically transition from step 1 to step 2 after adding a todo.
Update the onboarding flow to automatically transition from step 2 to step 3 after changing the filter a couple times.
Update the onboarding flow to automatically transition from step 3 to done after marking a few todos complete.
Write some tests!
References
redacted(reason:)
Apple’s new API for redacting content in SwiftUI.
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.