FetchRequest
@available(iOS 10, OSX 10.12, watchOS 3.0, tvOS 10, *)
public final class FetchRequest<T> where T : NSManagedObject
Fetch Request
Create and perform fetch requests.
-
Perform fetch request.
Returns array of objects that match with the provided object and other specified criteria.
Declaration
Swift
public func get() -> [T]
-
Perform fetch request asynchronously.
The block takes one parameter, array of objects that match with the provided object and specified criteria, or nil if error occurred.
Declaration
Swift
public func getAsync(_ completion: @escaping (([T]?) -> Void))
Parameters
completion
The block to execute when the request finishes.
-
Delete request.
Perform delete request on the main context.
Declaration
Swift
func delete()
-
Delete request asynchronously.
Performs the delete request asynchronously, using the NSBatchDeleteRequest.
- NSBatchDeleteRequest:
A request to Core Data to do a batch delete of data in a persistent store without loading any data into memory.
Declaration
Swift
func deleteAsync(_ completion: @escaping ((Bool) -> Void))
Parameters
completion
The block to execute after the request finishes. This block takes one parameter Bool, true if the request is successful or false.