Home

Awesome

QueryKit Mogenerator Template

Build Status

These templates are designed to add QueryKit attributes to your managed object subclasses.

@interface _Organisation : NSManagedObject

/// Returns an attribute for the name property.
+ (QKAttribute *)name;

/// Returns an attribute for the relationship members.
+ (PersonAttribute *)members;

@end

@interface _Person : NSManagedObject

/// Returns an attribute for the name property.
+ (QKAttribute *)name;

/// Returns an attribute for the relationship organisation.
+ (OrganisationAttribute *)organisation;

@end

You can use these attributes to perform queries:

NSPredicate *predicate = [[[Person organisation] name] equals:@"Cocode"];

Installation:

$ brew install --HEAD mogenerator
$ git clone https://github.com/QueryKit/mogenerator-template ~/.querykit-mogenerator-template

If you would like to pin to a specific version of the template, I would suggest that instead you use a git submodules within your project to add mogenerator-template pinned to a specific commit.

Usage:

To use the QueryKit template for mogenerator, pass in the template path --template-path ~/.querykit-mogenerator-template when invoking mogenerator.

mogenerator --template-path ~/.querykit-mogenerator-template