views:

67

answers:

1

I am new to Core Data, and am designing a schema. I would like to to comment things like:

  • This what the field name means, and this is what it should contain
  • Here is why we have this relationship
  • This integer corresponds to this enum
  • this field is in this encoding, or can only contain [a-zA-Z0-9-]

I've read over the Xcode Entity Modeling Tools for Core Data articles, and it appears that you can not add any sort of comments, either to the diagram or on a per-attribute basis. How do you document your schema?

+3  A: 

Unfortunately, there is no equivalent of annotations on the xcdatamodel document or comment fields associated with entities/attributes/relationships. In our shop, we have a separate document (an outliner works well) for annotating/commenting on xcdatamodels. Descriptive attribute/relationship names often goes a long way just on its own.

In terms of documenting constraints (e.g. "this field can only contain [a-zA-Z0-9-]"), that can be encoded in validation methods for the custom objects associated with an entity.

Barry Wark