Create your custom view router with SwiftUI (1/X)

How many pages do you want to have?

Implement in a view

  1. Set your variable to be the view you want to be displayed when the view shows up. I made the variable private, which is not really necessary here but it’s just a habit for me.
  2. Instead of putting content directly into your body, you provide a switchthat shows content based on the variable created above.
  3. Each case shows its own content. We don’t have any functionality to change the view here yet.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store