UIToolbar
A control that displays one or more buttons along an edge of your interface.
Declaration
@MainActor class UIToolbarOverview
To create toolbar items, use the UIBarButtonItem class. To add toolbar items to a toolbar, use the setItems(_:animated:) method.
Toolbar images that represent normal and highlighted states of an item derive from the image you set using the inherited image property from the UIBarItem class. The toolbar’s tintColor colors the image.
If you need radio button style controls, use the UITabBar class instead of UIToolbar.
When the system presents the toolbar with Liquid Glass:
Don’t apply custom backgrounds or appearances to UIToolbar. Instead, let the system determine the background appearance.
Don’t use
UIToolbardirectly when you present your view controller with a UINavigationController. Instead, set toolbarItems to get system-provided transitions and animations in your toolbar.
Split the toolbar’s shared background
By default, the system organizes all of the buttons you provide into one grouping that shares a background in the toolbar. To split buttons into different groupings with separate shared backgrounds, add fixedSpace() between buttons to indicate where you want to split the shared background.
For a button that finalizes or completes a task, set the button’s style to UIBarButtonItem.Style.prominent so that the system can avoid visually grouping the button with other buttons.