Relative Content

Tag Archive for swiftuiswiftui-navigationstack

SwiftUi navigate from alert

I started with swiftui recently and im just trying things and i cant seem to find a solution but i need to navigate to another screen but only after choosing yes in an alert that shows up.

NavigationStack – check which views are opened and close specific one

.navigationDestination(for: String.self){ selection in if(selection == “login”){ Login(path: $path) }else if(selection == “register”){ CreateAccount(path: $path) } } .onChange(of: path) { _ in if(path[path.count – 1] == “login” && path[path.count – 2] == “register”){ // if current view is login and the last one register, close register path.remove(path.count – 2) } if(path[path.count – 1] == “register” […]