Member-only story
SwiftUI: NavigationLink
Learn about the NavigationLink in Swift and SwiftUI
Let’s say you’re building an app called LyricList, a place where people can save and organize their favorite song lyrics. The app has two main screens: a list of saved lyrics and a detail view for each lyric. So how do we let users tap on a lyric and jump to the detail screen?
Enter NavigationLink.
This little SwiftUI gem is like a portal. It sits there calmly, usually inside a List or a VStack, waiting for a user to tap. When they do, it quietly opens a new screen. No segues. No prepare(for segue:). No Storyboard drama. Just clean, simple, SwiftUI.
Let’s walk through it.
The Basics of NavigationLink
At its simplest, a NavigationLink needs two things: A destination (the screen to go to) and a label (what the user taps on).
Here’s what’s happening:
- We wrap everything in
NavigationStack - Inside the
List, each lyric line becomes aNavigationLink. - When tapped, it slides us over to
LyricDetailView, passing the…









