Last active
November 29, 2017 20:28
-
-
Save jazzedge/e2f124cd21e96732ba2b7d2e228dbfa6 to your computer and use it in GitHub Desktop.
Each record is represented by a CKRecord object. Once you have created a new record you can simply call saveRecord:completionHandler: on your CKDatabase object. CloudKit will connect to the Internet asynchronously when saveRecord method is invoked. If you are saving a previously retrieved entry, any changes will update the version stored on Clou…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 01. Example of saving a single record | |
| let privateDB = CKContainer.defaultContainer().privateCloudDatabase | |
| let record = CKRecord(recordType: “Employee”) | |
| record.setObject(“John”, forKey: “name”) | |
| record.setObject(“Stephens Green West, Dublin 2, Dublin”, forKey: “address”) | |
| privateDB.saveRecord(record) { savedRecord, error in | |
| // handle errors here | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment