Sitemap

Member-only story

SwiftUI: NavigationLink

Learn about the NavigationLink in Swift and SwiftUI

4 min readMar 26, 2025

--

Press enter or click to view image in full size

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).

Press enter or click to view image in full size

Here’s what’s happening:

  • We wrap everything in NavigationStack
  • Inside the List, each lyric line becomes a NavigationLink.
  • When tapped, it slides us over to LyricDetailView, passing the…

--

--

Stanley Miller 
Stanley Miller 

Written by Stanley Miller 

iOS Developer. Author. Fan of the interesting. Written 100+ Swift/SwiftUI articles.