I really like this approach as it seems to be the cleanest. I wonder if this is an area SwiftUI can improve upon by flattening the need for an internal subview or if it is by design
Post
Replies
Boosts
Views
Activity
I filed the bug report here. I attached a sample project along with the crash reports: FB8276747
I got this working in a strange roundabout way. Looking through the crash logs, I saw this:
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'
My FetchRequest was similar to yours:
@FetchRequest(entity: Movie.entity(), sortDescriptors: [])
var movies: FetchedResults<Movie>
Moving fetch request creation to a new static variable and using another @FetchRequest wrapper, it now does not crash:
static var getMoviesFetchRequest: NSFetchRequest<Movie> {
let request: NSFetchRequest<Movie> = Movie.fetchRequest()
request.sortDescriptors = []
return request
}
@FetchRequest(fetchRequest: getMoviesFetchRequest)
var movies: FetchedResults<Movie>
And now it works. I am not sure why, but something is going on with the entity not being set. I hope to file a bug report tomorrow with sample code.
I am seeing this same issue in beta 4 released today. I have tried clearing DerivedData and it is still happening
This worked perfectly! Thank you very much!
I need to touch up on Swift generics...