Skip to content

Instantly share code, notes, and snippets.

@cristibaluta
Last active April 23, 2017 10:49
Show Gist options
  • Save cristibaluta/a6ca68b35cdd03e83d1a2cd46c14cf8c to your computer and use it in GitHub Desktop.
Save cristibaluta/a6ca68b35cdd03e83d1a2cd46c14cf8c to your computer and use it in GitHub Desktop.
extension CloudKitRepository {
func fetchRecords (ofType type: String, predicate: NSPredicate, completion: @escaping ((_ ctask: [CKRecord]?) -> Void)) {
let query = CKQuery(recordType: type, predicate: predicate)
privateDB.perform(query, inZoneWith: customZone.zoneID) { (results: [CKRecord]?, error) in
if let results = results {
completion(results)
} else {
completion(nil)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment