NavigationLink で画面を表示する
タップして詳細ビューへ移動します。
「NavigationLink で画面を表示する」はCoddyKit上の無料SwiftUI Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSwiftUI Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 SwiftUI Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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. 🎉
よくある質問
「NavigationLink で画面を表示する」レッスンは無料ですか?
はい。「NavigationLink で画面を表示する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、SwiftUI Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 SwiftUI Academyコースには全4レッスンが含まれています。
「NavigationLink で画面を表示する」で何を学びますか?
タップして詳細ビューへ移動します。 ブラウザで直接実行するハンズオンコードでSwiftUI Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
SwiftUI Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのSwiftUI Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「NavigationLink で画面を表示する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このSwiftUI Academyレッスンでコードを書いて実行できますか?
はい。すべてのSwiftUI Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- NavigationLink で画面を表示する
- 詳細ビューへのデータ受け渡し
- Toolbar とナビゲーション タイトル
- プログラムによるナビゲーション パス