{"id":15038613,"url":"https://github.com/nofelmahmood/cksrecordcontext","last_synced_at":"2025-12-12T06:17:52.205Z","repository":{"id":56904813,"uuid":"37806730","full_name":"nofelmahmood/CKSRecordContext","owner":"nofelmahmood","description":"Interaction with CloudKit Records done right !","archived":false,"fork":false,"pushed_at":"2015-06-23T12:42:30.000Z","size":372,"stargazers_count":21,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T00:31:44.590Z","etag":null,"topics":["ckrecord","cloudkit","cloudkit-databases","swift"],"latest_commit_sha":null,"homepage":"https://medium.com/p/cloudkit-in-context-1efd6ec23ed1","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/nofelmahmood.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}},"created_at":"2015-06-21T11:37:09.000Z","updated_at":"2020-04-12T20:36:14.000Z","dependencies_parsed_at":"2022-08-20T19:20:31.104Z","dependency_job_id":null,"html_url":"https://github.com/nofelmahmood/CKSRecordContext","commit_stats":null,"previous_names":["cloudkitspace/cksrecordcontext"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FCKSRecordContext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FCKSRecordContext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FCKSRecordContext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FCKSRecordContext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nofelmahmood","download_url":"https://codeload.github.com/nofelmahmood/CKSRecordContext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131468,"owners_count":21052819,"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":["ckrecord","cloudkit","cloudkit-databases","swift"],"created_at":"2024-09-24T20:39:13.448Z","updated_at":"2025-12-12T06:17:52.134Z","avatar_url":"https://github.com/nofelmahmood.png","language":"Swift","readme":"# CKSRecordContext\n\nA dead simple way of `Fetching`, `Inserting`, `Modifying` and `Deleting` records from the CloudKit Databases.\n\n## How To Use\n\nA CKRecordContext object holds all the new records, any changes and deletions to them until you call `save()` on an instance of it. It only then conveys the changes to the CloudKit Database.\n\n```swift\nvar cksRecordContext:CKSRecordContext = CKRecordContext(database: CKContainer.defaultContainer().privateCloudDatabase, recordZone: nil)\n```\n### Creating a new CKRecord\n\n```swift\nvar ckRecord = cksRecordContext.insertNewCKRecord(\"NewRecordType\")\n```\n\n### Modifying a CKRecord\n\nAny CKRecords you create using methods of CKRecordContext are monitored by it.\n\n### Deleting a CKRecord\n\n```swift\nvar ckRecord = cksRecordContext.insertNewCKRecord(\"NewRecordType\")\nckRecordContext.deleteRecord(record: ckRecord)\n```\n\nOR \n\n```swift\nvar ckRecord = cksRecordContext.insertNewCKRecord(\"NewRecordType\")\nckRecordContext.deleteRecord(recordID: ckRecord.recordID)\n```\n\n### Fetching Records\n\n```swift\nfunc fetchCKRecord(recordID:CKRecordID,completion:(record:CKRecord?,error:NSError!) -\u003e())\nfunc fetchCKRecords(recordType:String,predicate:NSPredicate,completion:(results:Array\u003cAnyObject\u003e?,error:NSError!) -\u003e())\nfunc fetchCKRecords(recordType:String,predicate:NSPredicate,sortDescriptors:[NSSortDescriptor],completion:(results:Array\u003cAnyObject\u003e?,error:NSError!) -\u003e())\n```\n\n### Saving the Insertions, Modifications and Deletions to server.\n\nIts a one liner !\n\n```swift\ncksRecordContext.save { (error) -\u003e (Void) in\n  if error != nil\n    {\n        print(\"Saved Successfully\")\n    }\n}\n```\n\n## Getting Started \nCheck out the sample iOS demo app.\n\n## Installation\n`CocoaPods` is the recommended way of adding CKSRecordContext to your project.\n\nYou want to to add pod `'CKSRecordContext', '~\u003e 0.5'` similar to the following to your Podfile:\n```\ntarget 'MyApp' do\n  pod 'CKSRecordContext', '~\u003e 0.5'\nend\n```\n\nThen run a `[sudo] pod install` inside your terminal, or from CocoaPods.app.\n\n\n## Credits\nCKSRecordContext was created by [Nofel Mahmood](http://twitter.com/NofelMahmood)\n\n## Contact \nFollow Nofel Mahmood on [Twitter](http://twitter.com/NofelMahmood) and [GitHub](http://github.com/nofelmahmood) or email him at nofelmehmood@gmail.com\n\n## License\nCKSRecordContext is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnofelmahmood%2Fcksrecordcontext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnofelmahmood%2Fcksrecordcontext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnofelmahmood%2Fcksrecordcontext/lists"}