UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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.