Hi everyone!
I am trying to add a toggle to the top toolbar in a Navigation View. What I end up getting is a small rounded rectangle with the toggle label inside the rectangle. I've attached a simple bit of code that shows the problem. Any clues what I'm doing wrong?
I'm using Xcode 13.4.1 The toggle doesn't show correctly in the preview, the simulator, or on my iPhone 12 mini running iOS 15.5
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
List {
NavigationLink(destination: Text("Destination")) {
Text("Navigate")
}
}
.navigationTitle("Test")
.toolbar {
Toggle(isOn: .constant(true)) {
Text("Label")
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}