Cœur
Cœur

Reputation: 38667

How to avoid a huge .xcmappingmodel file for small datamodel changes?

I currently have a unique MyProject.xcdatamodeld file. It is fairly easy to do the following, as no additional step is required:

But I will need a MyProject.xcmappingmodel if I want to:

My issue is that the initial size of the .xcmappingmodel (from model v1 to itself) is ranging from 2 MB to 10 MB and makes my app suddenly twice bigger!

If I want to make just a tiny change (removing or renaming a field), is there a way to do it without this huge size addition?

Upvotes: 0

Views: 191

Answers (1)

Mundi
Mundi

Reputation: 80265

What you describe can be done with a Core Data Lightweight Migration. The documentation states that you do not need a mapping model when the changes consist of

  • Simple addition of a new attribute
  • Removal of an attribute
  • A non-optional attribute becoming optional
  • An optional attribute becoming non-optional, and defining a default value
  • Renaming an entity or property

Upvotes: 2

Related Questions