Displaying a detail screen with NavigationLink - a free SwiftUI by Example tutorial
When a menu item is tapped, we want to bring in a detail view that shows more information. We already placed ContentView inside a navigation stack, so now we can use a new view type called NavigationLink. We need to give this a destination – what kind of thing it should show – as well as what to show on-screen for the link. In practice, this looks like all the other containers we’ve used so far, so let’s try it out with a neat shortcut: although we’re going to be showing a detail view in just a minute, we can use a regular text view as a placeholder. So, put this directly around the ItemRow code in ContentView.swift: That means the whole row is a navigation link with a destination of the item’s name. If you run the app now you’ll see two important differences: Being able to present text views like this is a great timesaver while building up user interfaces! Of course, we want more – we want a nice big picture, some details about the food, and more. So, press Cmd+N to make another new S
Displaying a detail screen with NavigationLink - a free SwiftUI by Example tutorial WWDC26: Save 50% on my books and bundles! >> < Polishing designs with fonts and colors Observable objects, environment objects, and @Published > Displaying a detail screen with NavigationLink Paul Hudson @twostraws April 11th 2024 Updated for Xcode 16.4 When a menu item is tapped, we want to bring in a detail view that shows more information. We already placed ContentView inside a navigation stack, so now we can use a new view type called NavigationLink . We need to give this a destination – what kind of thing
Explore this link on the map →related reading
- Building a menu using List - a free SwiftUI by Example tutorialhackingwithswift.com
- SwiftUI by Example - free quick start tutorials for Swift developershackingwithswift.com
- Composing views to create a list row - a free SwiftUI by Example tutorialhackingwithswift.com
- Polishing designs with fonts and colors - a free SwiftUI by Example tutorialhackingwithswift.com
- Using stacks to arrange views | Apple Developer Documentationdeveloper.apple.com
- allowsHitTesting(_:) | Apple Developer Documentationdeveloper.apple.com
- A Day in the Life of a SwiftUI View — Chris Eidhofchris.eidhof.nl
- Layout | Apple Developer Documentationdeveloper.apple.com
- Configuring views | Apple Developer Documentationdeveloper.apple.com
- Laying out a simple view | Apple Developer Documentationdeveloper.apple.com
- CADisplayLink | Apple Developer Documentationdeveloper.apple.com
- Invisible Details of Interaction Designrauno.me