Hello all - I’ve completed the first paid-for ‘Code With Chris’ course bundle (‘iOS Foundations’ which is fantastic by the way, I highly recommend it!) and I’m now trying to build an experimental app to put my new knowledge to the test.
I wanted to ask anyone’s advice on the best option for storing data on a user’s iPhone (for my experimental app) for long-term use.
To explain: my app needs to store an array, but one that is continually being added to over time.
The items in the array are small in size (basically just a class that consists of mostly just ‘Double’ values and some small ‘Strings’ items), but the number of items would grow over time (say 50,000+ items over a few years), so this piece of data could get to, say, 5MB+ in size.
I’d like to store this data, but for continuous and long-term reference and use (by the app).
I don’t want to use cache obviously (as it’s important data), and i don’t want to upload to a cloud-based database, nor do I really want to store directly in the user’s iCloud folder (since it’s application data, which the user doesn’t need file access to directly).
What would be the best method to store data like this on the device? (I’ve heard that a ‘Library’ folder exists with the app’s ‘Data Container’, which is backed up by a user’s normal iPhone backups… which sounds perfect for this!.. but i’ve no idea about how to store data to this.)
Also, in terms of storage formats, I know from the ‘Code With Chris’ course, that I could store it as JSON, but i’m wondering whether there’s a better, more ‘raw’, form to store data in (as it would save encoding/decoding each time, as the data is being continuously accessed and added to).
Any hints/thoughts would be welcome…
Many thanks in advance.