NSManagedObjectContext
Undocumented
-
Create and insert an NSManagedObject into context
self
. The type must conform toEntityType
.Example:
let user: User = moc.insert()
Declaration
Swift
public func insert<ObjectType: NSManagedObject where ObjectType: EntityType>() -> ObjectType
Return Value
The NSManagedObject created within the context.
-
Create an NSFetchedResultsController for the given type. The type must conform to
ManagedObjectType
. The results are sorted bydefaultSortDescriptors
and thesectionNameKeyPath
is set based on the first sort descriptor.Declaration
Swift
public func sortedFetchedResults<ObjectType: NSManagedObject where ObjectType: ManagedObjectType>( ofType type: ObjectType.Type, cacheName: String? = nil) -> NSFetchedResultsController
Parameters
type
The class for which the fetched results controller is created.
cacheName
The name of the cache file the receiver should use. Pass nil to prevent caching.
Return Value
The NSFetchedResultsController initialized with the given type, cache, and the default sort descriptors.