(Swift + CloudKit) or (SwiftUi + Core Data + CloudKit)

Hello everyone!

Im new to SwiftUI and I have been trying to pinpoint the best approach when sending and receiving data using CloudKit.

Is Core Data absolutely necessary to use when building an app with SwiftUI and CloudKit? I've read that Core Data is falling off, which is why I'm questionable on spending time learning it.

Couldn't I simply use SwiftUI and CloudKit without the use of anything else?

I do know that Core Data is NOT necessary when using CloudKit while writing Objective C, but I am wanting to stick solely with Swift as I have been told that Obj C is falling off too.

Thanks for the help!

  • https://developer.apple.com/documentation/cloudkit/determining_if_cloudkit_is_right_for_your_app

    TLDR - CoreData + CK is great for a single user to sync across his devices, it's incredibly easy you can practically ignore the CK part CK only if you want features where the user shares his data with others via his private DB, manage local caches, etc. This is harder.

Add a Comment

Replies

CoreData is definitely not "falling off" :-) Use SwiftUI+CoreData and sync with CloudKit, using either NSPersistentCloudKitContainer, an open-source sync engine like CloudCore, or a third-party sync engine like Ensembles.io

  • Thanks for your quick response!

    I know this is probably not surprising, but I just figured out a way to ping data to CloudKit without the use of Core Data. Metaphorically speaking, I would like to keep from having too many 'cooks in the kitchen', keeping my application as bare as it can be. This way, worrying about staying up-to-date with another feature like core data is one less struggle for me...especially if its not absolutely necessary

Add a Comment

It depends in so many factors, such as how many records you will have, if you need to be able to work offline, and so on.

I have an App (private) that shared a large number of records using CloudKit and a local cache with coredata. Now I'm dividing that App in multiple Apps and I thing I will use a mix between full synchronize tables and cache tables, all sharing the same record zone.

I would recommend that you start using only CloudKit, then you can start adding coredata for cache, if you realize that you need it.

  • I completely agree with your suggestion. Thank you for responding!

Add a Comment