I'm new to iOS dev and SwiftUI. And I have some very simple code, but it keeps crash in live preview, I don't know why... It runs completely normal in simulator though.
import SwiftUI
struct MainView: View {
@State var showingAlert = false
var body: some View {
NavigationView {
Button( "Tap me") {
showingAlert = true
}
.toolbar {
Label("bell", systemImage: "bell")
}
}
.alert("Alert", isPresented: $showingAlert) {
Button("OK", role: .destructive) { }
}
}
}
struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView()
}
}
But when I change the toolbar part a little, it turns to be ok.
.toolbar {
// Label("bell", systemImage: "bell")
Text("bell")
}
My Xcode Version 14.2 (14C18)