Add support for custom scalar attribute types… #177

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant

noahd commented Nov 5, 2013

…using the scalarAttributeType user info key.

Partially resolves #162.

Possible issues:

  • Namespace? For now, there's no mogenerator. prefix because I just named the info dictionary key after the method that uses it.
  • Still no easy way of using custom #imports for user-defined types. I solved this problem by importing the appropriate headers in the 'human' header of my base class (since I was only using custom scalar types in sub-entities anyway) but that's not a solution for everyone. Regardless, it's useful for Foundation types like NSTimeInterval and friends.

Although the generated scalar accessors will utilize the given type to box/unbox and cast without issues, Core Data (obviously) still constrains values to the "real" storage type of the attribute set in the data model.
Therefore, it's the developer's responsibility to make sure to only use values both types — i.e. the "real" attribute type set in the model and the custom one used in the generated classes — support, to mitigate casting/overflow/underflow issues.

Add support for custom scalar attribute types using the 'scalarAttrib…
…uteType' user info key.

Although the generated scalar accessors will utilize the given type to box/unbox and cast without issues, Core Data (obviously) still constrains values to the "real" storage type of the attribute set in the data model.
Therefore, it's the developer's responsibility to make sure to only use values both types — i.e. the "real" attribute type set in the model and the custom one used in the generated classes — support, to mitigate casting/overflow/underflow issues.

noahd commented Jul 11, 2014

#207 already does this…

@noahd noahd closed this Jul 11, 2014

@noahd noahd deleted the noahd:custom-scalar-attributes branch Jul 11, 2014

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