I'm getting this error:
Abnormal number of gesture recognizer dependencies: 700. System performance may be affected. Please investigate reducing gesture recognizers and/or their dependencies.
It's caused by a view that loads a project and queries a favorite model for a project. I use this data to determine which system image to show.
Here's my model:
import Foundation
import SwiftData
@Model
final class FavoriteModel {
@Attribute(.unique) var id: UUID = UUID()
@Attribute var createdDate: Date
@Relationship var project: Project
init(createdDate: Date = .now) {
self.createdDate = createdDate
}
}
Here's the init for my view:
@Query var favorites: [FavoriteModel]
init(project: Project?) {
self.project = project
guard let projectID = project?.id else { return }
let filter = #Predicate<FavoriteModel> {
$0.project.id == projectID
}
_favorites = Query(filter: filter, sort: \FavoriteModel.createdDate)
}
Here's the code that is responsible for the error:
Button {
//favorite
} label: {
if favorites.isEmpty {
Image(systemName: "heart")
} else {
Image(systemName: "heart.fill")
}
}
If I remove "favorite.isEmpty", the error disappears when I press the button. This use to work in Xcode 15 beta 4.
Is anyone else seeing this? It looks like a bug, but there's also probably a better solution.
Thanks,