{"id":19685915,"url":"https://github.com/rxswiftcommunity/rxcloudkit","last_synced_at":"2025-04-29T06:31:07.644Z","repository":{"id":89974933,"uuid":"95135790","full_name":"RxSwiftCommunity/RxCloudKit","owner":"RxSwiftCommunity","description":"RxCloudKit (based on RxSwift)","archived":false,"fork":false,"pushed_at":"2019-07-02T07:10:22.000Z","size":85,"stargazers_count":9,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-05T13:51:20.572Z","etag":null,"topics":["cloudkit","ios","reactive","reactive-extensions","reactive-programming","rxswift","swift"],"latest_commit_sha":null,"homepage":"","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/RxSwiftCommunity.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":"2017-06-22T16:33:56.000Z","updated_at":"2023-05-23T22:58:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"62627068-46cd-4566-8785-590b2f018512","html_url":"https://github.com/RxSwiftCommunity/RxCloudKit","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxCloudKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxCloudKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxCloudKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxCloudKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RxSwiftCommunity","download_url":"https://codeload.github.com/RxSwiftCommunity/RxCloudKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251450656,"owners_count":21591407,"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":["cloudkit","ios","reactive","reactive-extensions","reactive-programming","rxswift","swift"],"created_at":"2024-11-11T18:24:42.223Z","updated_at":"2025-04-29T06:31:07.638Z","avatar_url":"https://github.com/RxSwiftCommunity.png","language":"Swift","readme":"# RxCloudKit is based on RxSwift\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\nCarthage setup.\n\n```\ngithub \"RxSwiftCommunity/RxCloudKit\" ~\u003e 1.1.0\n\n```\n\nCopyright (c) RxSwiftCommunity\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxswiftcommunity%2Frxcloudkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frxswiftcommunity%2Frxcloudkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxswiftcommunity%2Frxcloudkit/lists"}