See the identical query utilizing UIKit
with photographs! I am attempting to do the identical factor in SwiftUI, the place the consumer begins at SecondView()
with the FirstView()
decrease within the navigation stack; however have not been capable of learn the way to programmatically push on the NavigationStack with out having to {custom} handle stack states. Proper now, I’ve one thing like this:
NavigationStack {
FirstView()
}
.onFirstAppear {
// Code that pushes SecondView() to the NavigationStack
}
(OnFirstAppear
is a {custom} extension that runs the primary time the view will get rendered.)
Is there any approach to do that in order that
- It seems to the consumer as if
SecondView()
is the place the route begins – that means no animations - Has a again button on the
SecondView()
that takes the consumer to theFirstView()
- Ideally not custom-manage states.