Hi y'all!
I'm creating an iOS app with SwiftUI. Part of the app's layout will have a toolbar.
Per the HIG's Toolbar article, under the section titled "Actions", the primary action in the toolbar should use the .prominent
modifier.
Unfortunately, I'm having issues finding information about this modifier in the SwiftUI reference documentation, and Xcode's code completion (the standard completions; I don't use the language model version) doesn't reveal anything that seems to be usable to create the desired effect.
For reference, this is what the view currently looks like:
VStack {
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button("Add Something", systemImage: "plus") {
print("perform action")
}
}
}
Is this modifier added to the button itself as .buttonStyle(.borderedProminent)
? This seems to create an odd off-center layout shift in the Xcode preview, the Simulator, and my physical device. Is it added to the toolbar item with a similarly-named modifier?
Thanks all! :)