Sync to iCloud with CKSyncEngine

RSS for tag

Discuss the WWDC23 Session Sync to iCloud with CKSyncEngine

View Session

Posts under wwdc2023-10188 tag

2 Posts
Sort by:
Post not yet marked as solved
5 Replies
1.2k Views
I am working on a SwiftUI application that needs to sync data across multiple devices using CloudKit. I am trying to decide between two options: CKSyncEngine with a custom model SwiftData plus CloudKit container. This decision is crucial for me because the application I am developing is using tree structured data and the relationship between the data is very complex. I would appreciate your guidance on which option is better suited for my needs. One of the benefits of using SwiftData is that it has a lot of interesting features that can save me a lot of development time, such as automatic migrations, batch operations, predicates, sorting, grouping, etc. However, one of the drawbacks is that it may not be flexible enough to handle the complex data display logic that I need for my application. For example, I need to show different views depending on the level and type of the tree nodes, and I also need to perform some calculations and transformations on the data before displaying it. I am afraid that using SwiftData will lead to more complexity and uncertainty when implementing these features, and there may be performance issues as well. Another factor that I need to consider is the future support and development of these options. I believe SwiftData will have a good future because it is based on Apple's frameworks and technologies. However, I don't know if CKSyncEngine will be valued in the long run because it is a third-party framework that may not be updated or maintained regularly. In conclusion, I am still unsure whether to use CKSyncEngine or SwiftData for my SwiftUI application that needs CloudKit sync. Both options have their pros and cons, and I need to weigh them carefully according to my requirements and preferences. I would love to hear your opinion on this matter. Thank you for your time and attention.
Posted Last updated
.
Post not yet marked as solved
0 Replies
500 Views
I do not see in the sync API how to set the save policy. Does it effectively always use .ifServerRecordUnchanged? If so, does this mean that the app needs to persist the CKRecord that it last provided to or received from the sync engine so that the next time it has changes to submit they will be associated with the proper change tag? Or does the sync engine handle this behind the scenes and the app only needs to worry about the CKRecord.ID? I would like to ensure that if there is a conflict the sync engine has enough information to give me the .ancestorRecord, as I need that for proper resolution.
Posted
by mjt.
Last updated
.