Instance Method

fetchRequestFromTemplateWithName:substitutionVariables:

Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary.

Declaration

- (NSFetchRequest *)fetchRequestFromTemplateWithName:(NSString *)name substitutionVariables:(NSDictionary<NSString *,id> *)variables;

Parameters

name

A string containing the name of a fetch request template.

variables

A dictionary containing key-value pairs where the keys are the names of variables specified in the template; the corresponding values are substituted before the fetch request is returned. The dictionary must provide values for all the variables in the template.

Return Value

A copy of the fetch request template with the variables substituted by values from variables.

Discussion

The variables dictionary must provide values for all the variables. If you want to test for a nil value, use [NSNull null].

This method provides the usual way to bind an “abstractly” defined fetch request template to a concrete fetch. For more details on using this method, see Creating Predicates.

See Also

Getting Fetch Request Templates

fetchRequestTemplatesByName

A dictionary of the receiver’s fetch request templates, keyed by name.

- fetchRequestTemplateForName:

Returns the fetch request with a specified name.

- setFetchRequestTemplate:forName:

Associates the specified fetch request with the receiver using the given name.