Database Reference
In-Depth Information
UnCloudNotesDataModel in the “Based on Model” field. Xcode will now create a
copy of the data model.
Note: You can give this file any name you want. The sequential v2, v3, v4, et
cetera naming helps you tell the versions apart easily.
This step will create a second version of the data model, but you still need to tell
Xcode to use the new version as the current model. In the File Inspector pane on
the right, find the option toward the bottom called Model Version . Change that
selection to match the name of the new data model, UnCloudNotesDataModel
v2 :
Once you've made that change, notice in the project navigator that the little green
check mark icon has moved from the previous data model to the v2 data model:
Core Data will load the ticked version when setting up the stack. The older version
is there to support migration—it's hard to migrate to a new model without knowing
the old one!
Make sure you have the v2 data model selected and add an image attribute to the
Note entity. Set the attribute's name to image and the attribute's type to
Transformable .
Since this attribute is going to contain the actual binary bits of the image, you'll use
a custom NSValueTransformer to convert from binary bits to a UIImage and back
again. Just such a transformer has been provided for you as ImageTransformer . In
the Value Transformer Name field in the Data Model Inspector on the right of the
screen, enter UnCloudNotes.ImageTransformer .
Search WWH ::




Custom Search