{"id":19688579,"url":"https://github.com/maxvol/combinecloudkit","last_synced_at":"2026-05-16T03:02:23.349Z","repository":{"id":89974588,"uuid":"381680423","full_name":"maxvol/CombineCloudKit","owner":"maxvol","description":"Access CloudKit via Combine","archived":false,"fork":false,"pushed_at":"2022-04-10T09:23:29.000Z","size":54,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-10T08:09:04.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxvol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-30T11:35:15.000Z","updated_at":"2021-10-02T04:46:28.000Z","dependencies_parsed_at":"2023-05-30T18:00:36.133Z","dependency_job_id":null,"html_url":"https://github.com/maxvol/CombineCloudKit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxvol%2FCombineCloudKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxvol%2FCombineCloudKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxvol%2FCombineCloudKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxvol%2FCombineCloudKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxvol","download_url":"https://codeload.github.com/maxvol/CombineCloudKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240995316,"owners_count":19890707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T18:38:22.525Z","updated_at":"2026-05-16T03:02:23.294Z","avatar_url":"https://github.com/maxvol.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CombineCloudKit\nAccess CloudKit via Combine\n\nCloned from RxCloudKit, instead of `.rx.something` write `.somethingPublisher` -\n\nBasic usage.\n\n```swift\nprivateDB.rx.save(record: ckRecord).subscribe { event in\n    switch event {\n        case .success(let record):\n            print(\"record: \", record)\n        case .error(let error):\n            print(\"Error: \", error)\n    }\n}.disposed(by: disposeBag)\n```\n\n\"RxCKRecord\" class provides syntactic sugar for copying data  (including CloudKit metadata) between CKRecord objects and plain structs. \n\n```swift\nstruct MyRecord {\n    var myField: String\n}\n\nextension MyRecord: RxCKRecord {\n    static var zone = \"MyZone\"\n    static var type = \"MyType\"\n    mutating func readUserFields(from record: CKRecord) {\n        // TODO \n    }\n}\n\nlet myRecord = MyRecord(myField: \"\")\nlet ckRecord = try! myRecord.asCKRecord()\n\n//\n\nmyRecord.read(from: ckRecord)\n\n```\n\n\"Cache\" class is an out of the box solution for maintaining a local cache of CloudKit records. Tokens are stored in UserDefaults.\n\n```swift\nvar cache: Cache {\n    return Cache(delegate: self, zoneIDs: [\"MyZone\"])\n}\n\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -\u003e Bool {\n    // Override point for customization after application launch.\n    application.registerForRemoteNotifications()\n    self.cache.applicationDidFinishLaunching()\n    return true\n}\n\nfunc application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -\u003e Void) {\n    self.cache.applicationDidReceiveRemoteNotification(userInfo: userInfo, fetchCompletionHandler: completionHandler)\n}\n```\n\n```swift\nextension AppDelegate: CacheDelegate {\n\n    public func cache(record: CKRecord) {\n        // TODO store record in CoreData\n    }\n\n    public func deleteCache(for recordID: CKRecordID) {\n        // TODO delete record in CoreData\n    }\n\n    public func deleteCache(in zoneID: CKRecordZoneID) {\n        // TODO delete everything relevant to zone in CoreData\n    }\n    \n    public func query(notification: CKQueryNotification, fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -\u003e Void) {\n        // TODO store/delete record in CoreData\n    }\n\n}\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxvol%2Fcombinecloudkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxvol%2Fcombinecloudkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxvol%2Fcombinecloudkit/lists"}