CoreDataEntityProtocol

public protocol CoreDataEntityProtocol : AnyObject

Describes an entity in Core Data.

  • The name of the entity.

    Declaration

    Swift

    static var entityName: String { get }
  • The default sort descriptors for a fetch request.

    Declaration

    Swift

    static var defaultSortDescriptors: [NSSortDescriptor] { get }

Available where Self: NSManagedObject

  • entityName Default implementation

    Default Implementation

    Returns a default entity name for this managed object based on its class name.

    Declaration

    Swift

    public static var entityName: String { get }
  • fetchRequest Extension method

    Returns a new fetch request with defaultSortDescriptors.

    Declaration

    Swift

    public static var fetchRequest: NSFetchRequest<Self> { get }
  • entity(context:) Extension method

    Returns the entity with the specified name from the managed object model associated with the specified managed object context’s persistent store coordinator.

    Declaration

    Swift

    public static func entity(context: NSManagedObjectContext) -> NSEntityDescription

    Parameters

    context

    The managed object context to use.

    Return Value

    Returns the entity description for this managed object.