0Pricing
SwiftUI Academy · Lesson

Pushing Screens with NavigationLink

Navigate to a detail view on tap.

Pushing Screens with NavigationLink is a free SwiftUI Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the SwiftUI Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Screens That Stack

Real apps move between screens. In SwiftUI you wrap your content in a NavigationStack so you can push new screens on top and slide back. 📱

NavigationStack {
    HomeView()
}

What NavigationLink Does

A NavigationLink is a tappable label that pushes a new view onto the stack. Tap it and the next screen slides in from the right.

NavigationLink("Details") {
    DetailView()
}

Link Lives Inside the Stack

A NavigationLink only works when it sits inside a NavigationStack. Without that wrapper, the tap has nowhere to push to and nothing happens.

NavigationStack {
    NavigationLink("Open") { DetailView() }
}

A Custom Label

The link label can be any view, not just text. Give the label closure a row of icon and text to make the tap target feel rich.

NavigationLink {
    DetailView()
} label: {
    Label("Profile", systemImage: "person")
}

The Destination Closure

The first closure is the destination: the screen that appears when tapped. SwiftUI builds it lazily, only when the user actually navigates.

NavigationLink {
    SettingsView()
} label: {
    Text("Settings")
}

The Back Button Is Free

You never build the back button yourself. The stack adds a back button automatically, and swiping from the left edge also returns to the previous screen. 👍

Links Inside Lists

Links shine in a List. Each row becomes tappable and gets a chevron, giving you the classic iOS drill-down feel for free.

List {
    NavigationLink("Inbox") { InboxView() }
    NavigationLink("Sent") { SentView() }
}

Push, Do Not Replace

Pushing adds a screen on top of the stack rather than replacing the current one. That is why the back button can return you exactly where you were.

Nesting Goes Deep

A pushed screen can hold its own links, so users can drill down level after level. The stack remembers the whole path and unwinds it one tap at a time.

Keep One Stack Per Flow

Put a single NavigationStack at the root of each navigation flow. Nesting stacks inside each other usually causes confusing, broken back behavior.

A Tiny Mistake to Avoid

Forgetting the surrounding NavigationStack is the most common beginner bug. The link renders but tapping it does nothing, so always check the wrapper first.

Quick Check

Where must a NavigationLink live to actually push a screen?

Recap: Pushing Screens

You wrap content in a NavigationStack and use NavigationLink to push detail screens, with the back button handled for you. Next, you will pass data along. 🎉

Frequently asked questions

Is the “Pushing Screens with NavigationLink” lesson free?

Yes — the full text of “Pushing Screens with NavigationLink” is free to read here on the web, and the SwiftUI Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the SwiftUI Academy course, upgrade to CoddyKit PRO.

What will I learn in “Pushing Screens with NavigationLink”?

Navigate to a detail view on tap. You practise SwiftUI Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start SwiftUI Academy?

No prior experience is required. SwiftUI Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Pushing Screens with NavigationLink” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this SwiftUI Academy lesson?

Yes. Every SwiftUI Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Pushing Screens with NavigationLink
  2. Passing Data to Detail Views
  3. Toolbar & Navigation Title
  4. Programmatic Navigation Paths
← Back to SwiftUI Academy