Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plain Core Data vs Core Data + Magical Record

I'm planning a way to persist data for an iOS (swift) app. From reading a bunch of articles about persistance on iOS, it seems Core Data is a really well supported way to do that. A bunch of libraries/tools are built around it, one popular combination seems to be MoGenerator + MagicalRecord + Core Data.

As MagicalRecord provides some kind of Active Record functionality, it seems it could be "easy" to accidentally break things. I've been told it could happen that users would have to reinstall their app to recover from such failures.

So question: is it feasible to use just plain Core Data instead of MoGenerator + MagicalRecord + Core Data? Or is this so low level, that it only makes to use raw Core Data for big teams? Can the pros/cons be compared to those of plain SQL vs ORM?

like image 589
Philip Avatar asked Dec 12 '22 01:12

Philip


1 Answers

I would strongly recommend to NOT use MR or Mogenerator until you know enough about Core Data to know WHY to use them.

Magical Record really can seem like magic if you don't understand what it is doing under the hood. And to use Core Data without a good understanding of the basic framework is to invite problems that you will never get to the bottom of. There are Core Data traps that you are going to need to understand, whatever tool you use.

CD is not really low-level compared with MR: but is more verbose (MR is saving you a lot of boilerplate). However I would recommend spending a bit of time with a decent book like Learning Core Data for iOS by Tim Roadley. When you have worked through that, you may find - as codeFi suggests - that you have built yourself a core data engine that does enough for you so that the addition of Magical Record unnecessary.

Another problem with going for MR is that the stable release, 2.2, is two years old. V2.3 is still in beta, and going forwards the focus is on 3.0. If you use the stable release, and find issues with it, they won't get fixed. If/when v3.0 is ready, the interface may be completely different anyway.

like image 100
foundry Avatar answered Dec 30 '22 06:12

foundry