Mac Developer Library

Developer

Core Data Framework Reference NSFetchRequestExpression Class Reference

Options
Deployment Target:

On This Page
Language:

NSFetchRequestExpression

Instances of NSFetchRequestExpression represent expressions which evaluate to the result of executing a fetch request on a managed object context.

NSFetchRequestExpression inherits from NSExpression, which provides most of the basic behavior. The first argument must be an expression which evaluates to an NSFetchRequest object, and the second must be an expression which evaluates to an NSManagedObjectContext object. If you simply want the count for the request, the countOnly argument should be YEStrue.

  • Returns an expression which will evaluate to the result of executing a fetch request on a context.

    Declaration

    Swift

    class func expressionForFetch(_ fetch: NSExpression, context context: NSExpression, countOnly countFlag: Bool) -> NSExpression

    Objective-C

    + (NSExpression *)expressionForFetch:(NSExpression *)fetch context:(NSExpression *)context countOnly:(BOOL)countFlag

    Parameters

    fetch

    An expression that evaluates to an instance of NSFetchRequest.

    context

    An expression that evaluates to an instance of NSManagedObjectContext.

    countFlag

    If YEStrue, when the new expression is evaluated the managed object context (from context) will perform countForFetchRequest:error: with the fetch request (from fetch). If NOfalse, when the new expression is evaluated the managed object context will perform executeFetchRequest:error: with the fetch request.

    Return Value

    An expression which will evaluate to the result of executing a fetch request (from fetch) on a managed object context (from context).

    Availability

    Available in OS X v10.5 and later.

  • This constant specifies the fetch request expression type.

    Declaration

    Swift

    var NSFetchRequestExpressionType: Int { get }

    Objective-C

    enum { NSFetchRequestExpressionType = 50 };

    Constants

    • NSFetchRequestExpressionType

      NSFetchRequestExpressionType

      Specifies the fetch request expression type.

      Available in OS X v10.5 through OS X v10.10.3.