LAST CHANCE: Save 50% on all my Swift books and bundles! >>

SOLVED: Can i use core data to store information for my app

Forums > SwiftUI

Hi All,

Lets say i have a list of cars for my app and i always want them to be available in the app - for every user.

Can i store these in core data or is this just for stuff individual to the user?

Thanks

Adam

3      

You can ship your app with the list of cars in CoreData. Then it's available for everyone using your app. If you want the user to enter cars in your app on his device and want that these are available for every other user of your app you need an external database service.

3      

Thanks so much for this.

How would i go about adding cars to core data that every user can use?

3      

a) Use CloudKit with public database https://developer.apple.com/icloud/cloudkit/

b) Have some sort of custom backend with database and save the cars there

In both cases there will be a lot of syncing required. I think the CloudKit route will be much easier.

You would then still save the cars objects into Core Data but also kept track of sync status and upload new ones to the public database.

3      

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until July 28th.

Click to save your free spot now

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.