Managed
public protocol Managed : NSFetchRequestResult
A protocol for objects that are managed by a CoreData NSManagedObjectContext
-
The name of the model that defines instances of the managed type
Declaration
Swift
static var entityName: String { get }
-
defaultSortDescriptors
Default implementationOrdering for instances fetched from the persistent container. By default there is no ordering.
Default Implementation
Default sort definition
Declaration
Swift
static var defaultSortDescriptors: [NSSortDescriptor] { get }
-
FetchRequest
Extension methodUndocumented
Declaration
Swift
public typealias FetchRequest = NSFetchRequest<Self>
-
FetchConfigurator
Extension methodUndocumented
Declaration
Swift
public typealias FetchConfigurator = (FetchRequest) -> Void
-
Initializer
Extension methodUndocumented
Declaration
Swift
public typealias Initializer = (Self) -> Void
-
typedFetchRequest
Extension methodObtain generic fetch request
Declaration
Swift
public static var typedFetchRequest: FetchRequest { get }
-
sortedFetchRequest
Extension methodObtain a fetch request that is sorted according to defaultSortDescriptors
Declaration
Swift
public static var sortedFetchRequest: FetchRequest { get }
-
count(in:
Extension methodrequest: ) Count the number of items returned by a given fetch request
Declaration
Swift
public static func count(in context: NSManagedObjectContext, request: FetchRequest) -> Int
-
fetch(in:
Extension methodrequest: ) Create a fetch request and execute it.
Declaration
Swift
public static func fetch(in context: NSManagedObjectContext, request: FetchRequest) -> [Self]
Parameters
context
the context where the managed objects live
request
what to request
Return Value
array of managed objects
-
findOrCreate(in:
Extension methodrequest: initializer: ) Find or create a managed object
Declaration
Swift
public static func findOrCreate(in context: NSManagedObjectContext, request: FetchRequest, initializer: Initializer) -> Self
Parameters
context
the context where the managed objects live
request
what to request
block
code to run to initialize an object
Return Value
found/created managed object
-
findOrFetch(in:
Extension methodrequest: ) Create a fetch request that returns the first item that matches a given predicate.
Declaration
Swift
public static func findOrFetch(in context: NSManagedObjectContext, request: FetchRequest) -> Self?
Parameters
context
the context where the managed objects live
predicate
the match definition
Return Value
optional found object
-
materializedObject(in:
Extension methodmatching: ) Obtain the first registered object in the context that matches a given predicate.
Declaration
Swift
public static func materializedObject(in context: NSManagedObjectContext, matching predicate: NSPredicate?) -> Self?
Parameters
context
the context where the managed objects live
predicate
the match definition
Return Value
optional found object
-
delete()
Extension methodDelete the managed object
Declaration
Swift
public func delete()
-
appState
Extension methodObtain the ManagedAppState singleton from the context associated with this entity
Declaration
Swift
public var appState: ManagedAppState { get }