el-flor
el-flor

Reputation: 1476

iOS - Data storage best practices

I have an app which requires an internet connection to work. But there is an option that allows the user to download specific data, which then enables the app to be used in offline mode. This means that in every page of my app I have two scenarios: my user has internet and I download the data (JSON format), parse it and use it, or he doesn't have internet and if he downloaded it, I use it. When he downloads it I store the data the CoreData.

I'm wondering if CoreData really is the best way to do this. Wouldn't it be easier to simply store the downloaded JSON data somewhere, without parsing it, and then just chosing to use the online JSON data or the offline JSON data (in which case I could simply have one method to parse the data afterwards, instead of the two I use now).

What are the best practices?

Upvotes: 0

Views: 207

Answers (1)

Tj3n
Tj3n

Reputation: 9923

Based on what you needs, saving CoreData enable to do more than just saving the data, it can query, update and manage object instance and can use to both save and send request later, but if you just want save a single JSON then its not required, can become a lot boilerplate code also.

Upvotes: 0

Related Questions