Saving Data in iOS - Part 13: Section 2: JSON | Ray Wenderlich

Learn what JSON is, so you'll know what to expect when you use it to save your Encodable types.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4307-saving-data-in-ios/lessons/13

Nice course guys! I’m wondering: can you use JSON for storing user preferences / settings of the app? Would you recommend using NSUserDefaults, CoreData or some other solution for this?

You could use JSON for that.

Apple actually uses a property list behind the scenes, for UserDefaults. If you want the user to be able to interact with your preferences from the Settings app, then you’ll need to implement a Settings Bundle as well. We didn’t go into that in this course because it has become less common to rely on the Settings app over time, as apps have become more complex.

Personally, I’m a fan of using Core Data locally, and CloudKit remotely. I recommend trying out at least all of these options you’ve mentioned, and maybe some third-party ones like Realm or Firebase, if that would make sense for your needs, before settling. But if you’re short on time, you can make them all work!

Thanks Jessy! Reason I was thinking about JSON is because my ‘future app’ probably needs cross platform support. Syncing data between iOS, web and Android. But I’ve never built a settings screen before so I’m not sure how the pros approach this.
For the time being I will definitely learn the Apple frameworks CoreData, CloudKit first, afterwards maybe Realm and Firebase. A lot to learn and it is so much fun!

1 Like