Hello,
I have a simple SwiftUI app for macOS. It uses CoreData as data storage. I have a @FetchRequest and use the resulting array to populate a Table. I have added .searchable to have a search field. I usually can search without problems. Yet, some valid search strings result in a crash repeatedly giving:
Swift/Collection.swift:722: Fatal error: Index out of bounds
The crash happens in the main thread and the call stack is buried within refresh code for the table. It happens after [NSTableView _delegate_isGroupRow:] is called .
This is a big show stopper and I have no possibility to interfere since it happens in code out of my control. ´
My table code is without sections and simple like this:
var table: some View {
Table(selection: $selection, sortOrder: $items.sortDescriptors) {
TableColumn("Authors", value: \.authorsForDisplay!).width(min:30, ideal:50, max:200)
TableColumn("Title", value: \.title!).width(min:100, ideal:300, max:500)
TableColumn("Year", value: \.year) { article in
Text(String(article.year))
}.width(min:50, ideal:50, max:50)
TableColumn("Journal") { article in
Text(article.journal?.name ?? "---")
}.width(min:30, ideal:50, max:200)
TableColumn("Publisher") { article in
Text(article.publishedBy ?? "---")
}.width(min:30, ideal:50, max:200)
}
rows: {
ForEach(items) { article in
TableRow(article)
}
}}
Any ideas?
Thx, Volker