CloudKit offline storage - ios

I'm developing iOS app which is using CloudKit. I'm pretty clear how to download/upload data from cloud when requested on the device. It works just fine when internet connection is present. I'm thinking to allow users to access their data offline also. After brief research I discovered that CoreData integration with iCloud was depreciated as of recent Xcode release. I found some third party pods on github which let you handle this problem by syncing core data from device to iCloud. I'm a bit skeptical using those plugins due to possible data loss or other issues. Is the idea behind depreciating CloudKit to move away from offline storage? Im thinking now what to do... should I attempt to create some sort of sync between core data and iCloud or not use core data at all and just let users to access data only when online connection available. Such approach would save device storage but restrict data access to online only. Any recommendations ?

CoreData integration with iCloud is not depreciated, here are some references from Apple:
Setting up core data with CloudKit
Syncing a core data store with CloudKit
Mirroring a core data store with CloudKit
WWDC 2019 - Using Core Data With CloudKit

Related

iOS Offline Storage for Chat history

I want to store the offline messages, in Chatting Application for Chat history, with text, image, Video thumb with Video url link and location (lat,long) values.
How to store in offline and maintain DataBase?
There are several options for offline storage in iOS
SQLite
CoreData
NSCoding
For this particular task, I believe CoreData will do a better job. It is secure.
You can start with CoreData with the following tutorial. I suggest you to watch the following video for best practices in core data.

CloudKit and Core sync data between devices

I created a simple Notes app based on Core data. Now i want add sync between user devices.
And all articles that i read (this, this) said that i should fully get rid of my core data database, and all my code will lost and rework all with ICloud kit?
The is no way to sync data from Core Data to ICloud ? And if i get rid of core data, how my app will work offline ?
And please suggest good simple projects with ICloud sync
P.S. I googled about an hour. Icloud is deprecated so do sync with it is not recommended. I confused. How now i can sync data between devices??
Core Data used to have iCloud syncing, but it has been deprecated as of iOS 10. It had several problems, sometimes major.
Apple now has something called CloudKit, which is not the same thing. You can use CloudKit to sync data between devices. But this does not mean that you should drop Core Data. CloudKit only syncs; it is not a replacement for having your app save data on the device, it's only a way to send data to other devices. If you're using CloudKit, you also need to use some other way to store data on the local device.
Also, it's "CloudKit". Not "ICloud Kit". I don't know why, but it's important to get the names right.

CloudKit With CoreData Initial Sync On New Device

I have an app that uses CloudKit to sync a private database data between multiple devices. I am using CoreData for local persistence of the data. When the user downloads my app on a new device, I am currently downloading all the records from CloudKit and performing a lot of processing to properly build the CoreData persistence on the new device. As the amount of records grows, the processing time will continue to grow.
I was thinking it would be more efficient to transfer a copy of CoreData from iCloud file storage to build the initial local persistence file on the new device. Is there a way to use CloudKit in conjunction with iCloud file storage to build the initial persistence file and then use CloudKit to maintain synchronization between devices after the initial sync?
All the tutorials I have seen use either CloudKit or iCloud file storage rather than a hybrid approach.

Using iCloud for core data sync

Mine is a background application. There are thousands of data that are stored in local storage and till now i've been syncing the data to a remote server using http post. I want to know whether it is possible for me to use iCloud to sync my core data and then is it possible to sync from iClod to a remote server. I just want to use iCloud for storage purpose. I meant can it be operated like Parse and other third party cloud servers. I'm stuck with this. Any help would be greatly appreciated.
The only thing iCloud with Core Data does for you is sync data between multiple devices that use the same iCloud account.
I want to know whether it is possible for me to use iCloud to sync my core data...
Sync from one device to another, yes.
...and then is it possible to sync from iClod to a remote server.
If you're using Core Data with iCloud, you're still using Core Data, so any server sync you're doing now with Core Data will continue to work in the same way.
I just want to use iCloud for storage purpose.
It does store the user's data on the iCloud service, though it can only be accessed through your app.
I meant can it be operated like Parse and other third party cloud servers.
It depends on what Parse (or other third party) services you're interested in. Parse does more than iCloud, it's not really the same thing. If you would use Parse only to sync data between different devices, you could probably use iCloud. If you would use Parse in any other way at all, iCloud is not a replacement.

Best practice to sync webservice with offline storage on iOS

I have been working on a few iOS applications that talk to a REST API on the web server and than sync some data down for offline usage. The app then stores data locally if network connection is not available and than syncs with backend whenever the Internet connection is available.
I am wondering if there is a nice pattern or set of rules or library that can be used. I would rather not code this again and again. I know the business logic / sync logic would be different for each app but the rest of the work (ie. storing it locally, calling REST API) can be abstracted out.
Any ideas?
I use the RestKit framework in my app for the exact scenario you describe. The downloaded data are stored in a Core Data store for offline usage.

Resources