Mit NavigationLink zu Bildschirmen wechseln
Navigieren Sie beim Antippen zu einer Detailansicht.
Mit NavigationLink zu Bildschirmen wechseln ist eine kostenlose SwiftUI Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des SwiftUI Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der SwiftUI Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
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. 🎉
Häufig gestellte Fragen
Ist die Lektion „Mit NavigationLink zu Bildschirmen wechseln“ kostenlos?
Ja — der vollständige Text von „Mit NavigationLink zu Bildschirmen wechseln“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des SwiftUI Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der SwiftUI Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Mit NavigationLink zu Bildschirmen wechseln“?
Navigieren Sie beim Antippen zu einer Detailansicht. Du übst SwiftUI Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um SwiftUI Academy zu starten?
Keine Vorkenntnisse erforderlich. SwiftUI Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.
Wie lange dauert die Lektion „Mit NavigationLink zu Bildschirmen wechseln“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser SwiftUI Academy-Lektion Code schreiben und ausführen?
Ja. Jede SwiftUI Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Mit NavigationLink zu Bildschirmen wechseln
- Daten an Detailansichten übergeben
- Toolbar und Navigationstitel
- Programmgesteuerte Navigationspfade