SwiftUI Fundamentals

Feb 28 2023 · Swift 5.7, macOS Venture 13.1, Xcode 14.2

Part 2: Navigation & Data Flow

12. NavigationStack

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 11. NavigationViews Next episode: 13. Present Modal Views

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

iOS 16 introduced a new way to navigate with NavigationStack. You may be thinking “wait, NavigationView is essentially a stack, so what’s the difference?”. That’s a great question.

NavigationStack {
  List(artworks) { artwork in ...}
}      
List(artworks, id: \.self) { artwork in
}
.navigationTitle("Artworks")
List(artworks) { artwork in
  NavigationLink(value: artwork) {
    Text(artwork.title)
  }
}
.navigationDestination(for: Artwork.self) { artwork in
  DetailView(artwork: artwork)
}

Split View

In the last episode, using NavigationView on the iPad, you had to add a DetailView to the NavigationView so something would show on the screen at launch. Is this still needed?