I'm getting a crash on my iPhone (but not in simulator) whenever I include a navigation bar title in my SwiftUI view. If I take out the navigation bar title everything works just fine, but I need the title there. Here's my code:
NavigationView {
List {
ForEach(self.viewModel.tasks) { task in
TaskRow(task: task)
}
.onDelete(perform: self.viewModel.delete(indexSet:))
}
.listStyle(.grouped)
.edgesIgnoringSafeArea(.bottom)
.navigationBarTitle(Text("mainTitle")) //EXC_BAD_ACCESS crash here
}
UPDATE
I stripped the code above down and started a new project to make sure it wasn't my custom UI or my business logic doing something weird. The code below produces the same crash on my iPhone.
struct ContentView : View {
var body: some View {
NavigationView {
List {
ForEach((0...10).identified(by: \.self)) { val in
Text("test")
}
}
.listStyle(.grouped)
.edgesIgnoringSafeArea(.bottom)
.navigationBarTitle(Text("Hey"))
}
}
}
Any idea why this is happening or how to fix it?