I am getting desperate with .toolbar in Xcode Version 12.2 beta 3 (12B5035g).
I have got this code:
import SwiftUI
struct ContentView: View {
let displayedStrings: [String]
var body: some View {
List(displayedStrings, id: \.self) { message in
Text(message)
}
.navigationTitle("Messages")
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Primary Action") {}
}
#if os(iOS)
ToolbarItem(placement: .bottomBar) {
Button("Bottom Bar") {}
}
#endif
ToolbarItem(placement: .status) {
Button("Status") {}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(displayedStrings: ["String 1", "String 2", "String 3"])
}
}
In Simulator (for iPhone 12 mini and iPad Air 4th gen) there is a toolbar at the bottom with two buttons:
"Button Bar", aligned left
"Status", aligned center
On macOS version 11.0 Beta (20A5395g) the app crashes on start:
dyld`_dyld_debugger_notification:
> 0x113b12c6c <+0>: pushq %rbp
0x113b12c6d <+1>: movq %rsp, %rbp
0x113b12c70 <+4>: popq %rbp
0x113b12c71 <+5>: retq
Items placed e.g. as .confirmationAction or .cancellationAction or .destructiveAction do not show anywhere at all.
I shall be most thankful for any directions pointing to working examples or instructions including toolbars for iOS and macOS in SwiftUI!