Various enhancements for general and personal use #129

Closed
wants to merge 10 commits into
from

Conversation

Projects
None yet
3 participants
@bgulanowski

These changes combine a few different features. I've included my own templates (the zeroth feature) to support them, along with a few changes that alter the way type names are emitted. Probably you won't want those.

You may also not want one feature that I added just for myself. It depends on a custom class (available if requested) used to wrap a CFUUID. It creates a one-way relationship using standardized attribute names ("uuid" on the destination, and "<attribute_name>UUID" on the source). The additional code and template support automatically generate a custom accessor which wraps a generated fetch request using the <attribute_name>UUID attribute on the source to match to the "uuid" attribute on the destination.

Somewhat similarly, custom fetched properties often only return one result (by design). As such, I have added support for a fetched property userInfo dictionary key with the name of the single result. The template generates a convenience method which returns the one result by returning the lastObject from the array result generated by the fetched property.

Thirdly, I have cleaned up the generation of class declarations to prevent duplicates and arrange them in alphabetical order.

Feel free to cherry pick these changes as desired.

bgulanowski added some commits Sep 15, 2012

Cleaner way to collect names of classes to declare for relationships …
…and transformable attributes. (Method declaration.)
Support for a custom convention.
Generates accessors for indirect relationships based on BAUUID transformable attribute. Invokes a fetch using the attribute as the 'uuid' attribute on the fetch's entity, and the entity is determined by either the attribute name or a userInfo dictionary entry.
Add some more safety in how UUID-based fetch keys are interpreted.
In ActorKit, the stateUUID property of ActorTrait does not map to a known Entity class at compile time. We must determine the right Entity at runtime. "State" is a protocol.
Support for declaring a fetched property that returns a single result…
…, using the key "fetchedResult" in the fetched property's userInfo dictionary.
Improve singular result convenience for fetched properties.
In your machine template, check isSingular, and if so, add a method to return the -lastObject from the fetched results array.
@bgulanowski

This comment has been minimized.

Show comment Hide comment
@bgulanowski

bgulanowski Sep 26, 2012

@mikkelee

This comment has been minimized.

Show comment Hide comment
@mikkelee

mikkelee Sep 26, 2012

Just an FYI, there's now (OS X 10.8+ / iOS 6.0+) an NSUUID class. It can be used like this:

  NSUUID *myUUID = [NSUUID UUID];

  NSString *stringRep = [myUUID UUIDString];

  //etc

Just an FYI, there's now (OS X 10.8+ / iOS 6.0+) an NSUUID class. It can be used like this:

  NSUUID *myUUID = [NSUUID UUID];

  NSString *stringRep = [myUUID UUIDString];

  //etc
Allow for providing class name of an implicit fetched property if it …
…is part of unknown model.

"fetchClassName" key in userInfo on fetch key attribute.
@rentzsch

This comment has been minimized.

Show comment Hide comment
@rentzsch

rentzsch Jan 14, 2013

Owner

Sorry, this is too much work for me to comb through and make sense out of. Specific Pull Requests welcome.

Owner

rentzsch commented Jan 14, 2013

Sorry, this is too much work for me to comb through and make sense out of. Specific Pull Requests welcome.

@rentzsch rentzsch closed this Jan 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment