Hi there, I'm having an app developed in the last weeks, and recently I'm testing it on iOS 18. This following piece of UI code has diff between iOS 18 and iOS version lower than 18.
I have a NavigationStack in my homeView, and the display difference is for its toolbar in one destination. I've tried both approaches in code, with header variable or ToolbarItemGroup used directly in the toolbar modifier, both would result in there being a spacer between the body VStack and toolbar, which is unexpected. Here's the code and a demo screenshot.
var body: some View {
// header
VStack(alignment: .leading) {
notificationView(
iconKey: "ErrorCircle",
contentKey: "receivedFile.notification.noNetwork.content"
)
fileListView
}
.toolbar {
// header
ToolbarItemGroup(placement: .principal) {
Button {
dismiss()
} label: {
Image(systemName: "chevron.backward")
}
.background(Color.yellow)
Spacer()
Text(LocalizedStringKey("title"))
.font(
.system(size: 17)
.weight(.semibold)
)
.background(Color.yellow)
Spacer()
Button {
print("click")
} label: {
Text("Click")
}
.background(Color.yellow)
}
}
.navigationBarBackButtonHidden()
.onAppear {
refreshAllFiles()
}
}
@ToolbarContentBuilder private var header: some ToolbarContent {
ToolbarItem(placement: .topBarLeading) {
Button {
dismiss()
} label: {
Image(systemName: "chevron.backward")
}
.background(Color.yellow)
}
ToolbarItem(placement: .principal) {
Text(LocalizedStringKey("receivedFileList.title"))
.font(
.system(size: 17)
.weight(.semibold)
)
.background(Color.yellow)
}
ToolbarItem(placement: .topBarTrailing) {
Button {
print("click for jumping")
} label: {
Text("Click for jumping")
}
.background(Color.yellow)
}
}
Hope I can get some help from the forum on the usage. If not fixable, may I know if this is a known issue that would be fixed in the next upgrades.