UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SignUp, SignIn and Main Views Navigation architecture

Forums > SwiftUI

Hi Hacking with Swift!

I'm working on my first own app, and I'm trying to figure out the best way to tackle my problem. link to drawing

As user opens the app and is not logged in, it will be presented with Sign Up page, from where if they already have an account, can click button/link to go to login screen. After succesful authentication step (sign in or sign up) they will go directly to MainView (tab view at the moment).

with having just login stage I had simple if close

if userNotLogged display login screen, else displat main screen

userNotLogged comes from observableObject handling authentication with firebase.

my problems started when i broke it down to sign in and sign up separate pages, and i put those two in NavigationView, and then main view as alternative in if above.

the problem is when I sign in (second screen) in navigation view on my phone app crashes when login is succesful.

what would be the best practise approach to this 3 state navigation flow?

best regards and happy coding, Mat

1      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.