How to Add Bar Items to a Navigation View in SwiftUI
July 9, 2025·1 min read·by dockui

Let’s walk through how to add bar items the easy way, and how to customize where they show up.
Adding Buttons to the Navigation Bar
Here’s a simple example that adds two buttons to the top-right corner of a navigation view.
Code Snippet
Customizing Button Placement
Want to control exactly where your buttons go? Use ToolbarItem and set the .placement.
Here's how to add a back-style button on the leading side of the navigation bar:
Code Snippet
This gives you more control and can help with readability, and design alignment.
Recap
- Use .toolbar to easily add items to your navigation view.
- Use ToolbarItem with .placement to control where things go.
Bar items are a small thing, but they make your app feel complete and native. 🎉
Code copied to clipboard!