Comment

Comment by bsaul

Same experience, except i would strongly advise against using core data, and i would also recommend to do layout with autolayout in xib ( not storyboards) for complex views, instead of code, and use manual layout only for performance critical code.

Many people don't realize they don't actually need a database.

. Most app have their full set of data weight less than a megabyte, so it fits in memory without any trouble.

. Querying is often never more than a call to a map on an array ( simpler to debug than a core data query, and type safe)

. Atomicity with concurrent access, if you absolutely need it, is a real mess in core data. Even with core data you often end up doing everything on a single thread anyway (and most often this is the main thread).

. Core data will blow up in your face, either when trying to upgrade your app, or duplicate the data for backup. In ways that'll make you sweat everytime you push a new version.

So my advice is to work with a dumb data structure ( structs and not classes) that you dump in a file when application goes to background (or periodically if you want to play it safe), and perform your queries manually, and load all at once at application start.

And if you need parallell access to the data, work with message passing style concurrency, and have a data component that works within its own thread ( very easy to do with gcd). You'll feel like writing a bit of boilerplate code, but at least you'll understand what's going on.

parent bsaul 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton