Search code examples
ioscore-datansdocumentdirectory

iOS: save text to documents directory or core data entity?


In my app, the user has a collection of leaves (and a leaf is a core data entity in my XCode project). I'd like to create a note-taking feature so that they can write/save notes for each leaf in their collection. I would imagine this would require saving text for each item as an attribute of the the core data entity or storing it in the documents directory

Is it better memory management/app efficiency to save text with core data or documents directory? I know that its not good to save images in core data and I was wondering if there are other best practices I should be aware of/can implement!


Solution

  • Since you're talking about written notes, there's no need to worry about efficiency at all. We're talking about a few hundred bytes per note. That's at least a factor 1000 away from where performance might become an issue.

    Just do what's the easiest. As you already seem to suggest that would be storing the note texts directly in CoreData objects.