Skip to content

How to migrate to 0.6.0 with dynamic routes? #83

Discussion options

You must be logged in to vote

Hi @fishcharlie !

Usually the best approach is to have a top-level view that either shows the logged out flow (with a FlowStack) or the logged in view (which might also have its own FlowStack), e.g.:

struct RootView: View {
  @EnvironmentObject private var secureStorage: SecureStorage

  var body: some View {
    if secureStorage.accounts.isEmpty {
      LoggedOutFlow()
    } else {
      MainView()
    }
  }
}

enum LoggedOutScreen: Hashable {
  case chooseServerView
  case login(URL, GetSiteResponse)
  case signup(URL, GetSiteResponse)
}

struct LoggedOutFlow: View {
  @State var routes: Routes<RootScreen> = []

  var body: some View {
    FlowStack($routes, withNavigation: true) {
      

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fishcharlie
Comment options

Answer selected by johnpatrickmorgan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants