1

I have an app similar structured to the new Notes app. A sidebar contains information about different files (date, title, excerpt) and the detail view shows the whole content.

To store data in my app, I use NSKeyedArchiver. Each file is stored seperatly to make iCloud Sync easier.

So here is my question: Is there any good way of storing and loading this data in the sidebar?

The problem is that when the app starts, it iterates through every available file to load the information needed. However, the whole object graph loads for each file even if I only need the date and the title. Is there anything I can do to optimize this?

Should I use a seperatly index file where all dates and titles are stored?

Am I using the wrong storage concept?

Any advice would be appreciated!

mangerlahn
  • 4,746
  • 2
  • 26
  • 50

1 Answers1

0

Sounds like what you need to do is store the key information (date and title) separately from the rest of the data.

When you start the app, you can load the key information and display it, then retrieve the rest of the data only when required, by linking the title to the content.

You could use CoreData for this - but probably overkill.

Realm will work very well for this. There's a good tutorial available here http://www.raywenderlich.com/112544/realm-tutorial-getting-started

Russell
  • 5,436
  • 2
  • 19
  • 27