I created a View that displays a button which has a Label with name and icon.
struct NewWordButtonView: View {
@State var isAlert: Bool = false
var body: some View {
Button {
isAlert.toggle()
} label: {
Label("change word", systemImage: "arrow.triangle.2.circlepath").fixedSize()
}
.buttonStyle(.bordered)
}
}
And it should look like this:
But when I add the View in a toolbar as a toolbar item the text disappear and only the icon remains. Like this:
Any suggestion?
Set titleAndIcon
label style to your label
, this will make sure to show both title and icon of the label.
Label("change word", systemImage: "arrow.triangle.2.circlepath")
.labelStyle(.titleAndIcon)
.fixedSize()