The Complete Guide to NavigationView in SwiftUI

Paul Hudson · 135K views · 2020 · 39:18

Open on YouTube

Software (other)UX & UI designtutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering SwiftUI navigation questions, pointing to specific timestamps for programmatic NavigationLink use, fixing blank split-view screens on large devices, and learning the basics.

Recommended by 4 people across 3 different months, 2020 to 2020.

What it is

A roughly 39-minute tutorial by Paul Hudson (Hacking with Swift) covering SwiftUI's NavigationView: titles and bar buttons, NavigationLink, programmatic navigation, split views, and handling macOS and watchOS. It was sponsored by RevenueCat and published in April 2020.

What people said

Recommends Braver Chiang · 2020-05 · Stack Overflow · on “Go to a new view using SwiftUI”

I think Jake's answer is the basic way to NextView. And I think the way bellow is a simple, formal, and dynamic way to try, if you really need to hit a BUTTON. According to Paul Hudson's Video [this video] , from 10'00" to 12'00". (should go to 12'00" to 15'00", if you want to go to different views by tapping different buttons.) (should go to 15'00" to 16'00", if you want to go to second view and go back automatically .) And more And here is the code example. import SwiftUI struct ContentView: View { @State var areYouGoingToSecondView: Bool // Step 2 var body: some View { NavigationView{ // Step 1 VStack { // Step 3 NavigationLink(destination: YourSecondView(), isActive: $areYouGoingToSecondView)

Recommends Moritz Schaub · 2020-11 · Stack Overflow · on “SwiftUI NavigationView not remember the state”

Yes there is a pretty easy way of using an state with an NavigationLink. There is a optional property isActive you give an @Binding variable, which also can be from an external Environment object using a @Published property inside the observable object. In Case you want to learn a bit more about SwiftUI NavigationView including the Navigation Link consider checking out this awesome video [this video] by Paul Hudson. It personally helped me a lot.

Recommends Nick Merritt · 2020-12 · Stack Overflow · on “iOS app blank navigationView opening screen on some device simulators and not others”

The solution was very simple and a matter of settings. Answer at ~29 mins in this Hacking With Swift video [ [this video] ][1]. Large screen iOS devices automatically split the screen into multiple views with default navigationView{} settings. I don't know what the blank screen was about, but this fixed the problem Simply add view modifier .navigationViewStyle(StackNavigationViewStyle()) I figured I'd self-answer instead of deleting the post because I had a lot of trouble finding solutions on the web! Hopefully this will be helpful to someone!

Recommends Simon · 2020-12 · Stack Overflow · on “Why My second view cannot jump back to the root view properly”

You will get the hang of it quite fast I'm sure! Here are some good tutorials. Long one: [this video] / Short one: [LINK]