So when there may be greater than 2 toolbar gadgets the default merchandise placement is all of the gadgets (ToolbarItem) within the hierarchy to the left and the final merchandise (ToolbarItem) within the hierarchy to the correct.
After i apply .toolbarColorScheme(.gentle, for: .bottomBar)
or .toolbarColorScheme(.darkish, for: .bottomBar)
modifier, and scroll all the way in which to the underside, the 2nd merchandise additionally goes to the correct aspect.
//
// ToolbarGlitchDemo.swift
// ToolbarGlitchDemo
//
// Created by rayhaanlykhan on 15/04/2024.
//
import SwiftUI
struct ToolbarGlitchDemo: View {
var physique: some View {
NavigationStack {
ZStack {
Colour.grey.ignoresSafeArea()
ScrollView {
ForEach(0..<15) { _ in
Rectangle()
.fill(.blue)
.body(width: 200, top: 200)
.body(maxWidth: .infinity)
}
}
}
.navigationTitle("Toolbar Glitch Demo")
.toolbar {
ToolbarItem(placement: .bottomBar) { // heart
HStack {
Picture(systemName: "scribble")
Picture(systemName: "gear")
}
.background(.yellow)
}
ToolbarItem(placement: .bottomBar) {
HStack {
Picture(systemName: "individual.fill")
}
.background(.pink)
}
ToolbarItem(placement: .bottomBar) {
HStack {
Picture(systemName: "individual")
Picture(systemName: "individual")
}
.background(.inexperienced)
}
}
.toolbarColorScheme(.gentle, for: .bottomBar)
}
}
}
#Preview {
ToolbarGlitchDemo()
}