Modelling a "wizard"-style application?

I'm implementing a SwiftUI frontend for a Objective-C++ codebase on macos for a medical application. The combination of SwiftUI and TCA has made my life easy, but the app also needs to be easy to use, since it'll be used by doctors, and so it makes sense to have a wizard-style onboarding process for them to setup the various parts of the application.

The design consists of a series of "pages" that allows the user to prepare the application. Each of the pages will need some validation of the input, and to perform some logic when moving to the next page in the wizard, and the final setup logic occurs at the end of the process.

I note that Isowords has a very limited onboarding system, with a linear set of steps but not a huge amount of computation behind it. Adding more logic to the Onboarding reducer seems silly, and my application needs to perform somewhat sophisticated activities with some steps, such as connecting to network services.

Has anybody got any experience with this kind of problem and might be able to offer some design hints? Should I just use the Destination pattern and implement a basic Reducer/View pair for each (though I suspect this may lead to massive "if" statements in both the view and reducer)? Or is there a clever way I've missed that might simplify the amount of boilerplate TCA code I need?


Hi @sbwilson, I think most likely you would want to approach this using stack-based navigation. That goes for whether you are building a "wizard" in TCA or in vanilla SwiftUI.

This allows each page of the wizard to be responsible for its own logic, and then the feature at the root of the stack can integrate all the features together. We have docs about navigation stacks here.

You can also use the Destination pattern, which we call tree-based navigation, but that works best when the wizard has a very explicit sequence of steps. If the steps can be mixed in matched in complicated ways, the stack-based approach is more appropriate.