Simple synchronization between apps with CloudKit
Do you need to synchronize data between apps on iOS? Then we recommend using CloudKit, simple synchronization through the user's iCloud account.
Syncing data between mobile devices doesn't have to be so difficult
Users now expect their data to be saved and synchronized in the cloud. To do this, a well-functioning backend is required that can handle accounts, password management, and access rights. In addition, logic for synchronizing the user's data is needed so that it is the same everywhere.
How we solved synchronization without a backend in Sleep Cycle Kids
This can become very complicated quite quickly. In the Sleep Cycle Kids app, there was a very natural need to synchronize the children's sleep data between caregivers. Since the app is only available for iOS, we have been able to use CloudKit, which is the technology that iCloud is based on. With the help of CloudKit, we have managed to establish synchronization completely without having to involve our own backend.
Sleep Cycle Kids
Sleep Cycle Kids is a native iOS app targeted at parents of young children.
Read more about the case
The advantage of using CloudKit is that all data storage, synchronization, and account management are handled by Apple. Moreover, all data is already encrypted and anonymized, which means we do not have to worry about managing sensitive data. As an additional bonus, the user does not need to create an account in the app since this is also managed by iCloud.
How does synchronization with CloudKit work?
From a technical standpoint, it works in such a way that there is a local database within the app that manages the data to be saved. This data is automatically synchronized with iCloud, which means that if the same iCloud account is used on another device, such as a Mac, iPhone, or iPad, then everything is synchronized in the background. In this way, the user has the same data on all devices.
One can also relatively easily choose to share the information with another user who has an iCloud account so that they too can see the same data. We have also made it possible for two or more people to share a child's sleep data and switch modes for whether the child is asleep or awake. This is then reflected in all the devices of the people who have been invited as the child's guardians.
As an additional bonus, the synchronization also works on an Apple Watch, which we naturally took advantage of. If the status on the watch is changed, it is reflected on the phone.