0

I'm making a catalog where the cells in my collection view will be either an image with a label or a pdf. There will be many collections and they themselves will be static. I want the user to be able to save the cells he likes and view them in his own custom view.

1) I could to store the image as data in Core Data.

2) I could just include the image in my App Bundle and load the image from there every time my app starts.

I've got it into to my head that reading data from a Core Data Store would give me more options when building my app as well as offer some boost in performance as opposed to reading it from the app bundle. Is that true? Keeping in mind of course that most of the data is static.

It seems inefficient to have images both serialized images in my app bundle and the pure data as well.

I think I'd rather have it all in the store but they have to be loaded from the bundle at some point in code right?

I'd love to know how other developers do it.

Josh Elias
  • 3,250
  • 7
  • 42
  • 73

1 Answers1

0

Now in Core Data there is an "allows external storage" option for binary data, which basically means if your file is bigger than 1 MB it will be stored automatically outside of your database, and you have to do nothing differently. In my opinion that's the way to get the best of both worlds, increased performance + automatization + fast queries (although they are slower than usual when you allow external storage, but still faster than doing it yourself)

  • So I would deserialized my images in my bundle into binary data. Store that data in core data. Then delete the original images and load from the binary data? – Josh Elias Apr 04 '13 at 00:42
  • wait you are talking user generated data or just icons and ui design stuff? for the latter core data is most definitely overkill. – InvalidReferenceException Apr 04 '13 at 00:47
  • I'm making a catalog where there are cells in my collection view will be either an image with a label or a pdf. There will be many collections and they themselves will be static. I want the user to be able to save the cells he likes and view them in his own custom view. – Josh Elias Apr 04 '13 at 00:51
  • if you want to ship with preloaded data you can save it directly in a core data database that you import on first launch into the user's own database. There is a tutorial here:http://www.raywenderlich.com/980/core-data-tutorial-how-to-preloadimport-existing-data – InvalidReferenceException Apr 04 '13 at 00:54
  • Thats looks like the ticket. Thank you so much! – Josh Elias Apr 04 '13 at 00:56