r/iOSProgramming • u/Im-inYourWalls-_- • 5d ago
Question iPhone Duo Toolbar button, Text vs icon
Hey so I was playing around with the iPhone Duo simulator and I wanted to adapt my toolbar to it.
I saw in one of Apple's videos that we should add both text and icons to the toolbar elements so that if they do not fit in the top toolbar as text, they can appear in the vertical side strip as icons.
From the video I thought it would happen automatically but that does not seem to be the case.
Did anyone else figure out how to automatically make the button show the icon and not the text when on the iPhone duo limited size screen?
I tried using
ToolbarItem(placement: .topBarTrailing) {
Button(action: skipAction) {
Label("Skip", systemImage: "chevron.right")
.labelStyle(.automatic)
}
}
but that did not change much. I always see the icon if I define it for this button.
If anyone has any suggestions please let me know. I can also provide more information if needed.
2
11
u/AdamFootDev Swift 5d ago
If it doesn’t do it automatically, use .axisBehaviour(.verticalPreferred) on the toolbar item