flâneur — a map of the web's best reading

Displaying a detail screen with NavigationLink - a free SwiftUI by Example tutorial

hackingwithswift.com · 1,590 words · saved by 1 readers

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