NSManagedObject
class NSManagedObject : NSObject
NSManagedObject extension that adds useful generic methods.
-
Returns the last object from given
NSFetchRequest
.Declaration
Swift
public class func lastObject<T>(from request: NSFetchRequest<T>, in context: NSManagedObjectContext) -> T? where T : NSManagedObject
Parameters
request
The request where the last object will be fetched.
context
NSManagedObjectContext
where the fetch will be executed. -
Returns all objects from given
NSFetchRequest
.Declaration
Swift
public class func allObjects<T>(from request: NSFetchRequest<T>, in context: NSManagedObjectContext) -> [T] where T : NSManagedObject
Parameters
request
The request where all objects will be fetched.
context
NSManagedObjectContext
where the fetch will be executed.