A taste of CoreData – A graph framework

yageek | 76 points

Since about 20003, I have made a bit of a career of removing CoreData and its predecessor EOF from applications.

Every time it has been a huge success in terms of simplicity, performance and reliability.

Replacing EOF happened in a feed-processing application[1]. We just processed everything in memory and persisted the incoming feed, which we wanted to do anyway for auditing. In that instance it wasn't so much a planned removal, but rather that we never came around to implementing the DB component.

Next up was a desktop application, Livescribe Desktop. It was using an atomic store, so there wasn't really any point to CoreData. Chucking it meant removing a lot of code and crash-sites.

For Wunderlist 3, we rewrote the storage layer to simply use a bunch of JSON files (our CTO used to shock people at conferences with that little nugget), and the "In-Process REST" ideas from [1]. So our persistence solution was essential [NSJSONSerialization dataWith...]. The day after we launched, I was shocked at the number of crash reports, but my colleagues informed me that they had 10x the amount the last time. With millions of users, you get into a lot of edge cases. Oh, ours was also the fastest of the clients.

Oh, I also gave a talk at UIKonf '17 about making a public transport data (sample) application 1000x faster by moving from CoreData/sqlite to a custom data representation.[2]

[1] https://link.springer.com/chapter/10.1007/978-1-4614-9299-3_...

[2] https://www.youtube.com/watch?v=kHG_zw75SjE&feature=youtu.be

mpweiher | 6 years ago

Kudos to OP for braving through CoreData. I’ve been using it on and off since it was released, and it’s an awfully cumbersome and error-prone framework. And as Apple adds more complexity to iOS, CoreData gets exponentially worse. I’m 200% convinced today that it’s far better to just store your users data in a more traditional cloud database instead. Especially with syncing, which Apple made ridiculously, unnecessarily hard to get right.

_sdegutis | 6 years ago

NSPredicate. Back in the day I fought through the CoreData only kinda SQL thing and eventually got a result but... These days I'd just shove it on SQLite and get 10x the performance for 10x less effort. God DAMN that was hard work.

https://developer.apple.com/library/content/documentation/Co...

RantyDave | 6 years ago

I've been using CoreData in a big project but the multithreading has been crashing my app a lot. Can anyone recommend me some alternatives for a simple, lightweight, 100% local data storage for iOS?

Unknoob | 6 years ago