I am trying to play with the new toolbar modifier in SwiftUI with following code.
struct ContentView: View {
private var testData = ["a", "b", "c"]
var body: some View {
NavigationView() {
List() {
Text("a")
Text("b")
Text("C")
}
.listStyle(SidebarListStyle())
.navigationTitle("Navigation")
}.toolbar {
ToolbarItem(placement: ToolbarItemPlacement.principal) {
Button(action: {}) {
Text("add")
}
}
}
}
}
The code works fine in macOS Big Sur. But the toolbar doesn't show up in iPad simulator with iOS 14.
Is there anything I miss?