Toolbar & Navigation Title
Add titles and toolbar buttons to bars.
Toolbar & Navigation Title is a free SwiftUI Academy lesson on CoddyKit — lesson 3 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.
Naming the Screen
Every screen deserves a clear name. The navigationTitle modifier puts a heading in the navigation bar so users always know where they are. 🧭
.navigationTitle("Inbox")Where the Title Goes
Attach navigationTitle to the content inside the NavigationStack, not to the stack itself. The bar then reads the title from the current screen.
NavigationStack {
List { }
.navigationTitle("Inbox")
}Large vs Inline
By default the title is large and shrinks as you scroll. Use navigationBarTitleDisplayMode to force a compact inline style instead.
.navigationBarTitleDisplayMode(.inline)Adding Toolbar Buttons
The toolbar modifier lets you place buttons in the navigation bar, like an add button or an edit action for the current screen.
.toolbar {
Button("Add") { addItem() }
}Choosing a Placement
Wrap each control in a ToolbarItem and pick a placement so buttons land on the correct side of the bar.
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button("Add") { }
}
}Leading and Trailing
Use topBarLeading for the left edge and topBarTrailing for the right. These adapt automatically for right-to-left languages. 🌍
Icons in the Bar
Toolbar buttons often use SF Symbols instead of words to stay compact. A small image keeps the bar tidy on every device.
Button {
addItem()
} label: {
Image(systemName: "plus")
}Many Buttons at Once
You can add several ToolbarItem entries in one toolbar block, grouping related actions like edit, share, and add together.
The Bottom Toolbar
Placement is not limited to the top. Use bottomBar to pin actions to the bottom of the screen for thumb-friendly controls.
ToolbarItem(placement: .bottomBar) {
Button("Done") { }
}Titles Follow the Stack
Each pushed screen sets its own title, and the bar updates as you navigate. The previous title even becomes the back button label.
Keep Bars Uncluttered
Resist filling the bar with buttons. Two or three clear actions keep the screen calm and easy to scan.
Quick Check
Which modifier adds buttons to the navigation bar?
Recap: Toolbar & Title
You name screens with navigationTitle and add buttons with toolbar and ToolbarItem placements. Up next, driving navigation entirely from code. 🚀
Frequently asked questions
Is the “Toolbar & Navigation Title” lesson free?
Yes — the full text of “Toolbar & Navigation Title” 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 “Toolbar & Navigation Title”?
Add titles and toolbar buttons to bars. 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 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Toolbar & Navigation Title” 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
- Pushing Screens with NavigationLink
- Passing Data to Detail Views
- Toolbar & Navigation Title
- Programmatic Navigation Paths