NSManagedObject
extension NSManagedObject
-
Aggregate operation.
Perform aggregate operations on a set of values.
Declaration
Swift
public static func aggregate(groupBy properties: [String]? = nil, for key: String, type: Aggregate, completion: ((NSFetchRequest<NSFetchRequestResult>) -> Void)? = nil) -> [[String : Any]]?Parameters
propertiesProperties to group by.
keyProperty to execute aggregate operation on.
typeAggregate operation type.
completionThe block to execute when NSFetchRequest is created, for further customization.
-
Save changes if any.
Calling this method will save all performed changes in the current context.
Declaration
Swift
public func save(context: NSManagedObjectContext? = nil)Parameters
contextSpecify which context to use to save changes, default is main context.
-
Delete current object.
Declaration
Swift
public func delete(_ completion: ((Bool) -> Void)? = nil)Parameters
completionThe block to execute when deletion finishes. The block takes one parameter Bool, true if the request is success or false.
NSManagedObject Extension Reference