TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Best practice to to 'separate' app data and the data from the user

Forums > SwiftUI

Need advice: best way to 'separate' app data and the user data in Swift(UI). F.i. in the app is a book database, and a user can add his/her notes. When I update the app with new functions and new books, the notes from the user should not get lost.

Maybe use JSON for the books and Core Data for the notes? What is the best practice? Any publication or course?

3      

We will assume that your book data is hard-coded into the app? This is not really the best way to maintain an app like this if you need to redistribute the app whenever a new book is added.

In your shoes I would keep the book data, which is to be available to all users, on a central server (e.g. a web server) and load the data from there when you start the app. JSON is probably as good a format as any for holding that data and I seem to remember that Paul has a nice and simple set of videos on how to read and parse JSON data into your app.

We further assume that you keep the user's comments private on the local device. I have not looked at other alternatives, but using Core Data for this seems to make perfect sense to me.

So it sounds like you have the right solutions in mind and just need to be clear about what goes where.

Best of luck!

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.