Post

Replies

Boosts

Views

Activity

Reply to Get CKRecord from core data entity
Hi Justin, I have the same trouble but using UIKit. CloudKit can manage mirroring with CoreData everywhere either SwiftUI or UIKit, so i am using the same feature as you do. And now I am stuck because cannot find info how to get CKRecord from my synchronised CoreData Entities. Did you find the solution?
Jul ’20
Reply to CloudKit + CoreData: Now how do I take advantage of CloudKit user-to-user sharing without losing CoreData + CloudKit synchronization?
I've tried to implement some code for sharing manually with working CloudKit + CoreData mirroring. I've stuck on the parent records (I have one-to-many relationship and child records need to be shared when parent record is shared) and here is why. I've implemented code that is setting parent records for each NSManagedObject's CKRecord, syncing works well, but it causes huge troubles like: I call my setParentRecords among other places from NWPathMonitor's pathUpdateHandler (literally when internet restored), and fetching NSManagedObjects that's CKRecords if any don't have parent on the server yet. Apple's NSCloudKitMirroringDelegate is doing the same also on internet restore. And my any fetching at this second causes crash of Mirroring. Mirroring do not work since this point and says "probably no internet" each time! I could not beat that problem and I am afraid that will have to implement whole sync by myself, even for privateDatabase just because of such bugs (and no any completion handlers in NSPersistentCloudKitContainer). So, simple fetch crashes whole mirroring until app restarted.
Jul ’20
Reply to Accepting again leaved share CloudKit causing token problems
I've figured out what happens here. Here is what we must do after leaving share: Leave share Perform sync again (to get new token)! Check if we received leaved share on step 2 at fetching because CloudKit server 50% chance will not return updated state if you will perform step 2 right after step 1. Looks like server need some short time to process updates from step 1, so we have to run step 2 for example in 2 seconds after step 1 (and anyway check step 3 after that as I have no idea if it can update it's state longer than half a second as usually). So, I do not allow to accept any shares until step 3 (check if step 2 fetch contains share deletion) succeeded. If it return deleted share, then it's safe to accept this share again and we will get all updates correctly.
Oct ’20
Reply to SwiftUI Scrollview disable clipping
You can disable clipping with help of Introspect for SwiftUI https://github.com/siteline/SwiftUI-Introspect Using it you can get underlying UIKit objects. In your case simply add this to the ScrollView. ScrollView(.horizontal, showsIndicators: false) { //..... } .introspectScrollView { view in view.clipsToBounds = false }
Apr ’22