{"id":22595176,"url":"https://github.com/nofelmahmood/seam","last_synced_at":"2025-10-28T00:03:12.422Z","repository":{"id":31378246,"uuid":"34941280","full_name":"nofelmahmood/Seam","owner":"nofelmahmood","description":"Seamless CloudKit Sync with CoreData","archived":false,"fork":false,"pushed_at":"2018-01-10T00:20:08.000Z","size":3024,"stargazers_count":669,"open_issues_count":26,"forks_count":64,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-03-29T08:11:12.483Z","etag":null,"topics":["carthage","cloudkit","coredata-model","swift","sync"],"latest_commit_sha":null,"homepage":"https://medium.com/@Nofel/reason-why-cloudkit-cannot-be-ignored-9c7806d76230","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":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-02T08:51:00.000Z","updated_at":"2025-01-07T10:08:58.000Z","dependencies_parsed_at":"2022-08-17T18:31:02.391Z","dependency_job_id":null,"html_url":"https://github.com/nofelmahmood/Seam","commit_stats":null,"previous_names":["nofelmahmood/cksincrementalstore"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FSeam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FSeam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FSeam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nofelmahmood%2FSeam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nofelmahmood","download_url":"https://codeload.github.com/nofelmahmood/Seam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312082,"owners_count":20918344,"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":["carthage","cloudkit","coredata-model","swift","sync"],"created_at":"2024-12-08T10:09:16.477Z","updated_at":"2025-10-28T00:03:07.386Z","avatar_url":"https://github.com/nofelmahmood.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![seamlogo](https://cloud.githubusercontent.com/assets/3306263/11891970/83208bf0-a585-11e5-98b5-3ac6bff009d9.png)\n\n\n[![Pod Version](https://img.shields.io/badge/pod-v0.6-blue.svg)](https://img.shields.io/cocoapods/v/Alamofire.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/badge/platform-iOS%20--%20OSX-lightgrey.svg)](https://img.shields.io/badge/platform-iOS%20--%20OSX-lightgrey.svg)\n[![License](https://img.shields.io/packagist/l/doctrine/orm.svg)](https://img.shields.io/packagist/l/doctrine/orm.svg)\n\nSeam allows you to sync your CoreData Stores with CloudKit.\n\n## Topics\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Getting Started](#getting-started)\n- [FAQ](#faq)\n- [Apps](#apps)\n- [Author](#author)\n- [License](#license)\n\n## Features\n- Automatic mapping of CoreData Models to CloudKit Private Databases\n- Supports Assets\n- Background Sync \n- Conflict Resolution\n\n## Requirements\n\n- iOS 8.0+ / Mac OS X 10.10+\n- Xcode 7.1+\n\n## Communication\n\n- If you want to contribute submit a [pull request](https://github.com/nofelmahmood/Seam/pulls).\n- If your app uses Seam I'll be glad to add it to the list. Edit the [List](APPS.md) and submit a [pull request](https://github.com/nofelmahmood/Seam/pulls).\n- If you found a bug [open an issue](https://github.com/nofelmahmood/Seam/issues).\n- If you have a feature request [open an issue](https://github.com/nofelmahmood/Seam/issues).\n- If you have a question, ask it on [Stack Overflow](http://stackoverflow.com).\n\nPlease read the [Contributing Guidelines](CONTRIBUTING.md) before doing any of above.\n\n## Installation\n\n### Cocoapods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate Seam into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\nuse_frameworks!\n\npod 'Seam', '~\u003e 0.6'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate Seam into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"Seam/Seam\" ~\u003e 0.6\n```\n\nRun `carthage update` to build the framework and drag the built `Seam.framework` into your Xcode project.\n\n## Usage\n\nAdd a Store type of ```SeamStoreType``` to a NSPersistentStoreCoordinator in your CoreData stack:\n\n``` swift\nlet persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: yourModel)\nlet seamStore = try persistentStoreCoordinator.addPersistentStoreWithType(SeamStoreType, \n                                                                          configuration: nil, \n                                                                          URL: url, options: nil) as? Store\n```\nObserve the following two Notifications to know when the Sync Operation starts and finishes:\n\n``` swift\n\nNSNotificationCenter.defaultCenter().addObserver(self, selector: \"didStartSyncing:\",\n                                                name: SMStoreDidStartSyncingNotification,\n                                                object: seamStore)\n\nNSNotificationCenter.defaultCenter().addObserver(self, selector: \"didFinishSyncing:\",\n                                                name: SMStoreDidFinishSyncingNotification,\n                                                object: seamStore)                                               \n\nfunc didStartSyncing(notification: NSNotification) {\n  // Prepare for new data before syncing completes\n}\n  \nfunc didFinishSyncing(notification: NSNotification) {\n  // Merge Changes into your context after syncing completes\n  mainContext.mergeChangesFromStoreDidFinishSyncingNotification(notification)\n}\n  \n```\n\nFinally call sync whenever and wherever you want:\n\n```swift\nseamStore.sync(nil)\n```\n\nTo trigger sync whenever a change happens on the CloudKit Servers. Subscribe the store to receive Push Notifications from the CloudKit Servers.\n\n```swift\nseamStore.subscribeToPushNotifications({ successful in\n    guard successful else { return }\n    // Ensured that subscription was created successfully\n})\n\n// In your AppDelegate\n\nfunc application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {\n    seamStore.sync(nil)\n}\n```\n\n\n## Attributes\n\nAll CloudKit Attributes are mapped automatically to your CoreData attributes with the exception of [CKAsset](https://developer.apple.com/library/ios/documentation/CloudKit/Reference/CKAsset_class/) and [CLLocation](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/).\n\nCKAsset and CLLocation can be used by setting the corresponding attribute as Transformable in your CoreData Model.\n\n| CloudKit  | CoreData |\n| ------------- | ------------- |\n| NSDate    | NSDate\n| NSData | NSData\n| NSString  | NSString   |\n| NSNumber | NSNumber |\n| CKReference | NSManagedObject |\n| CKAsset | Transformable |\n| CLLocation | Transformable |\n\n### Transformable Attributes\n\nCKAsset and CLLocation can be used in your CoreData model as Transformable attributes.\n\n1. To use **CKAsset** set **Transformable** as AttributeType and **CKAssetTransformer** as value transformer name for the attribute.\n\n![](https://cloud.githubusercontent.com/assets/3306263/11773251/f342fd36-a248-11e5-8b55-519400fdb600.png)\n\n2. To use **CLLocation** set **Transformable** as AttributeType and **CLLocationTransformer** as value transformer name for the attribute.\n\n![](https://cloud.githubusercontent.com/assets/3306263/11773252/f3459564-a248-11e5-89eb-197c32ef245a.png)\n\n\n## Relationships\n\n| CoreData Relationship  | Translation on CloudKit |\n| ------------- | ------------- |\n| To - one    | To one relationships are translated as CKReferences on the CloudKit Servers.|\n| To - many    | To many relationships are not explicitly created. Seam only creates and manages to-one relationships on the CloudKit Servers. \u003cbr/\u003e \u003cstrong\u003eExample\u003c/strong\u003e -\u003e If an Employee has a to-one relationship to Department and Department has a to-many relationship to Employee than Seam will only create the former on the CloudKit Servers. It will fullfil the later by using the to-one relationship. If all employees of a department are accessed Seam will fulfil it by fetching all the employees that belong to that particular department.|\n\n\u003cstrong\u003eNote :\u003c/strong\u003e You must create inverse relationships in your app's CoreData Model or Seam wouldn't be able to translate CoreData Models in to CloudKit Records. Unexpected errors and curroption of data can possibly occur.\n\n## Getting Started \n\nDownload the demo project. Run it and see the magic as it happens.\n\n## FAQ\n\n### tvOS Support ?\ntvOS provides no persistent local storage. Seam uses SQLITE file to keep a local copy of your database which is not possible with tvOS.\n\n## Apps\n\nA [list of Apps](APPS.md) which are using **Seam**.\n\n## Author\n\nSeam is owned and maintained by [Nofel Mahmood](http://twitter.com/NofelMahmood).\n\nYou can follow him on [Twitter](http://twitter.com/NofelMahmood) and [Medium](http://medium.com/@nofel)\n\n## License\n\nSeam is available under the MIT license. See the [LICENSE file](LICENSE.md) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnofelmahmood%2Fseam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnofelmahmood%2Fseam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnofelmahmood%2Fseam/lists"}