Search code examples
ioscore-datacore-data-migrationrubymotion

Using Core Data migrations without Xcode data designer


I'm using Core Data with Rubymotion, and I don't want to use the Xcode graphical data modeller, I'm just creating a bunch of NSEntityDescriptions and NSEntityAttributes in code, and it works great.

  • But I haven't figured out if it is possible to use Core Data schema migrations without creating the .xcdatamodeld files?

  • And also, if it's not possible to run migrations without .xcdatamodeld files, maybe there are some libs that can generate the required files from NSEntityDescriptions?

Thanks


Solution

  • Take a look at how MotionData is trying to achieve this. https://github.com/alloy/MotionData/blob/master/app/schema.rb#L108 Probably we have to play with NSMigrationManager. See their spec and how it might be able to use it https://github.com/alloy/MotionData/blob/master/spec/schema_spec.rb#L146 Please share us if you are able to figure this out. I am trying to solve the exact same problem too.