NSManagedObject.fetchRequest in Swift

Hi y'all,

I do wonder. Why doesn't the fetchRequest method on NSMangedObject return NSFetchRequest but instead is declared as this: func fetchRequest() ->NSFetchRequest

Seems a bit odd and make writing things in Swift 5.5 that use CoreData a bit more tricky with a lot of nasty casts.

What would you guys suggest? I'm trying to write a function that gets fetchRequest that is correct for the ManagedObject that I got. Make some changes to that fetch request. And pass it to generic function that takes NSFetchRequest and returns me bunch of Foos -> [Foo] , etc.