I want to make a method to return all NSManagedObject of a specific class as an extension:
extension NSManagedObject {
static func getAll() -> [NSManagedObject]? {
// code
}
}
How can I specify the exact type of returned objects? So, for class Animal, I could infer type in the next example:
let animals = Animal.getAll() // I want to animals already be [Animal]?, not [NSManagedObject]?