Guides and Sample Code Developer
Search

CloudKit Changes for Swift

CloudKit

Modified CKContainer
Declaration
From
class CKContainer : NSObject {
    init()
    class func `default`() -> CKContainer
     init(identifier containerIdentifier: String)
    class func withIdentifier(_ containerIdentifier: String) -> CKContainer
    var containerIdentifier: String? { get }
    func add(_ operation: CKOperation)
    func fetchAllLongLivedOperationIDs(completionHandler completionHandler: @escaping ([String]?, Error?) -> Swift.Void)
    func fetchLongLivedOperation(withID operationID: String, completionHandler completionHandler: @escaping (CKOperation?, Error?) -> Swift.Void)
    func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareMetadata(with url: URL, completionHandler completionHandler: @escaping (CKShareMetadata, Error) -> Swift.Void)
    func accept(_ metadata: CKShareMetadata, completionHandler completionHandler: @escaping (CKShare, Error) -> Swift.Void)
    func fetchUserRecordID(completionHandler completionHandler: @escaping (CKRecordID?, Error?) -> Swift.Void)
    func discoverAllIdentities(completionHandler completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Swift.Void)
    func discoverUserIdentity(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverAllContactUserInfos(completionHandler completionHandler: @escaping ([CKDiscoveredUserInfo]?, Error?) -> Swift.Void)
    func discoverUserInfo(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
    func discoverUserInfo(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
    func status(forApplicationPermission applicationPermission: CKApplicationPermissions, completionHandler completionHandler: CloudKit.CKApplicationPermissionBlock)
    func requestApplicationPermission(_ applicationPermission: CKApplicationPermissions, completionHandler completionHandler: CloudKit.CKApplicationPermissionBlock)
    func accountStatus(completionHandler completionHandler: @escaping (CKAccountStatus, Error?) -> Swift.Void)
    var privateCloudDatabase: CKDatabase { get }
    var publicCloudDatabase: CKDatabase { get }
    var sharedCloudDatabase: CKDatabase { get }
    func database(with databaseScope: CKDatabaseScope) -> CKDatabase
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool)
    func performSelector(inBackground aSelector: Selector, with arg: Any?)
    class func classForKeyedUnarchiver() -> AnyClass
    var classForKeyedArchiver: AnyClass? { get }
    func replacementObject(for archiver: NSKeyedArchiver) -> Any?
    class func classFallbacksForKeyedArchiver() -> [String]
    class func keyPathsForValuesAffectingValue(forKey key: String) -> Set<String>
    class func automaticallyNotifiesObservers(forKey key: String) -> Bool
    var observationInfo: UnsafeMutableRawPointer?
    func willChangeValue(forKey key: String)
    func didChangeValue(forKey key: String)
    func willChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func didChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func willChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func didChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options options: NSKeyValueObservingOptions = [], context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String, context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String)
    func observeValue(forKeyPath keyPath: String?, of object: Any?, change change: [NSKeyValueChangeKey : Any]?, context context: UnsafeMutableRawPointer?)
    class var accessInstanceVariablesDirectly: Bool { get }
    func value(forKey key: String) -> Any?
    func setValue(_ value: Any?, forKey key: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey inKey: String) throws
    func mutableArrayValue(forKey key: String) -> NSMutableArray
    func mutableOrderedSetValue(forKey key: String) -> NSMutableOrderedSet
    func mutableSetValue(forKey key: String) -> NSMutableSet
    func value(forKeyPath keyPath: String) -> Any?
    func setValue(_ value: Any?, forKeyPath keyPath: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKeyPath inKeyPath: String) throws
    func mutableArrayValue(forKeyPath keyPath: String) -> NSMutableArray
    func mutableOrderedSetValue(forKeyPath keyPath: String) -> NSMutableOrderedSet
    func mutableSetValue(forKeyPath keyPath: String) -> NSMutableSet
    func value(forUndefinedKey key: String) -> Any?
    func setValue(_ value: Any?, forUndefinedKey key: String)
    func setNilValueForKey(_ key: String)
    func dictionaryWithValues(forKeys keys: [String]) -> [String : Any]
    func setValuesForKeys(_ keyedValues: [String : Any])
    func fileManager(_ fm: FileManager, shouldProceedAfterError errorInfo: [AnyHashable : Any]) -> Bool
    func fileManager(_ fm: FileManager, willProcessPath path: String)
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval, inModes modes: [RunLoopMode])
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any, selector aSelector: Selector, object anArgument: Any?)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int, delegate delegate: Any?, didRecoverSelector didRecoverSelector: Selector?, contextInfo contextInfo: UnsafeMutableRawPointer?)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int) -> Bool
    var autoContentAccessingProxy: Any { get }
    class func version() -> Int
    class func setVersion(_ aVersion: Int)
    var classForCoder: AnyClass { get }
    func awakeAfter(using aDecoder: NSCoder) -> Any?
}
extension CKContainer : CVarArg {
}
extension CKContainer : Equatable, Hashable {
    var hashValue: Int { get }
}
extension CKContainer {
    var privateCloudDatabase: CKDatabase { get }
    var publicCloudDatabase: CKDatabase { get }
    var sharedCloudDatabase: CKDatabase { get }
    func database(with databaseScope: CKDatabaseScope) -> CKDatabase
}
extension CKContainer {
    func accountStatus(completionHandler completionHandler: @escaping (CKAccountStatus, Error?) -> Swift.Void)
}
extension CKContainer {
    func status(forApplicationPermission applicationPermission: CKApplicationPermissions, completionHandler completionHandler: CloudKit.CKApplicationPermissionBlock)
    func requestApplicationPermission(_ applicationPermission: CKApplicationPermissions, completionHandler completionHandler: CloudKit.CKApplicationPermissionBlock)
}
extension CKContainer {
    func fetchUserRecordID(completionHandler completionHandler: @escaping (CKRecordID?, Error?) -> Swift.Void)
    func discoverAllIdentities(completionHandler completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Swift.Void)
    func discoverUserIdentity(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverAllContactUserInfos(completionHandler completionHandler: @escaping ([CKDiscoveredUserInfo]?, Error?) -> Swift.Void)
    func discoverUserInfo(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
    func discoverUserInfo(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
}
extension CKContainer {
    func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareMetadata(with url: URL, completionHandler completionHandler: @escaping (CKShareMetadata, Error) -> Swift.Void)
    func accept(_ metadata: CKShareMetadata, completionHandler completionHandler: @escaping (CKShare, Error) -> Swift.Void)
}
extension CKContainer {
    func fetchAllLongLivedOperationIDs(completionHandler completionHandler: @escaping ([String]?, Error?) -> Swift.Void)
    func fetchLongLivedOperation(withID operationID: String, completionHandler completionHandler: @escaping (CKOperation?, Error?) -> Swift.Void)
}
To
class CKContainer : NSObject {
    init()
    class func `default`() -> CKContainer
     init(identifier containerIdentifier: String)
    class func withIdentifier(_ containerIdentifier: String) -> CKContainer
    var containerIdentifier: String? { get }
    func add(_ operation: CKOperation)
    func fetchAllLongLivedOperationIDs(completionHandler completionHandler: @escaping ([String]?, Error?) -> Swift.Void)
    func fetchLongLivedOperation(withID operationID: String, completionHandler completionHandler: @escaping (CKOperation?, Error?) -> Swift.Void)
    func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareMetadata(with url: URL, completionHandler completionHandler: @escaping (CKShareMetadata, Error) -> Swift.Void)
    func accept(_ metadata: CKShareMetadata, completionHandler completionHandler: @escaping (CKShare, Error) -> Swift.Void)
    func fetchUserRecordID(completionHandler completionHandler: @escaping (CKRecordID?, Error?) -> Swift.Void)
    func discoverAllIdentities(completionHandler completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Swift.Void)
    func discoverUserIdentity(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverAllContactUserInfos(completionHandler completionHandler: @escaping ([CKDiscoveredUserInfo]?, Error?) -> Swift.Void)
    func discoverUserInfo(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
    func discoverUserInfo(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
    func status(forApplicationPermission applicationPermission: CKApplicationPermissions, completionHandler completionHandler: @escaping CloudKit.CKApplicationPermissionBlock)
    func requestApplicationPermission(_ applicationPermission: CKApplicationPermissions, completionHandler completionHandler: @escaping CloudKit.CKApplicationPermissionBlock)
    func accountStatus(completionHandler completionHandler: @escaping (CKAccountStatus, Error?) -> Swift.Void)
    var privateCloudDatabase: CKDatabase { get }
    var publicCloudDatabase: CKDatabase { get }
    var sharedCloudDatabase: CKDatabase { get }
    func database(with databaseScope: CKDatabaseScope) -> CKDatabase
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool)
    func performSelector(inBackground aSelector: Selector, with arg: Any?)
    class func classForKeyedUnarchiver() -> AnyClass
    var classForKeyedArchiver: AnyClass? { get }
    func replacementObject(for archiver: NSKeyedArchiver) -> Any?
    class func classFallbacksForKeyedArchiver() -> [String]
    class func keyPathsForValuesAffectingValue(forKey key: String) -> Set<String>
    class func automaticallyNotifiesObservers(forKey key: String) -> Bool
    var observationInfo: UnsafeMutableRawPointer?
    func willChangeValue(forKey key: String)
    func didChangeValue(forKey key: String)
    func willChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func didChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func willChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func didChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options options: NSKeyValueObservingOptions = [], context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String, context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String)
    func observeValue(forKeyPath keyPath: String?, of object: Any?, change change: [NSKeyValueChangeKey : Any]?, context context: UnsafeMutableRawPointer?)
    class var accessInstanceVariablesDirectly: Bool { get }
    func value(forKey key: String) -> Any?
    func setValue(_ value: Any?, forKey key: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey inKey: String) throws
    func mutableArrayValue(forKey key: String) -> NSMutableArray
    func mutableOrderedSetValue(forKey key: String) -> NSMutableOrderedSet
    func mutableSetValue(forKey key: String) -> NSMutableSet
    func value(forKeyPath keyPath: String) -> Any?
    func setValue(_ value: Any?, forKeyPath keyPath: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKeyPath inKeyPath: String) throws
    func mutableArrayValue(forKeyPath keyPath: String) -> NSMutableArray
    func mutableOrderedSetValue(forKeyPath keyPath: String) -> NSMutableOrderedSet
    func mutableSetValue(forKeyPath keyPath: String) -> NSMutableSet
    func value(forUndefinedKey key: String) -> Any?
    func setValue(_ value: Any?, forUndefinedKey key: String)
    func setNilValueForKey(_ key: String)
    func dictionaryWithValues(forKeys keys: [String]) -> [String : Any]
    func setValuesForKeys(_ keyedValues: [String : Any])
    func fileManager(_ fm: FileManager, shouldProceedAfterError errorInfo: [AnyHashable : Any]) -> Bool
    func fileManager(_ fm: FileManager, willProcessPath path: String)
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval, inModes modes: [RunLoopMode])
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any, selector aSelector: Selector, object anArgument: Any?)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int, delegate delegate: Any?, didRecoverSelector didRecoverSelector: Selector?, contextInfo contextInfo: UnsafeMutableRawPointer?)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int) -> Bool
    var autoContentAccessingProxy: Any { get }
    class func version() -> Int
    class func setVersion(_ aVersion: Int)
    var classForCoder: AnyClass { get }
    func awakeAfter(using aDecoder: NSCoder) -> Any?
}
extension CKContainer : CVarArg {
}
extension CKContainer : Equatable, Hashable {
    var hashValue: Int { get }
}
extension CKContainer {
    var privateCloudDatabase: CKDatabase { get }
    var publicCloudDatabase: CKDatabase { get }
    var sharedCloudDatabase: CKDatabase { get }
    func database(with databaseScope: CKDatabaseScope) -> CKDatabase
}
extension CKContainer {
    func accountStatus(completionHandler completionHandler: @escaping (CKAccountStatus, Error?) -> Swift.Void)
}
extension CKContainer {
    func status(forApplicationPermission applicationPermission: CKApplicationPermissions, completionHandler completionHandler: @escaping CloudKit.CKApplicationPermissionBlock)
    func requestApplicationPermission(_ applicationPermission: CKApplicationPermissions, completionHandler completionHandler: @escaping CloudKit.CKApplicationPermissionBlock)
}
extension CKContainer {
    func fetchUserRecordID(completionHandler completionHandler: @escaping (CKRecordID?, Error?) -> Swift.Void)
    func discoverAllIdentities(completionHandler completionHandler: @escaping ([CKUserIdentity]?, Error?) -> Swift.Void)
    func discoverUserIdentity(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverUserIdentity(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKUserIdentity?, Error?) -> Swift.Void)
    func discoverAllContactUserInfos(completionHandler completionHandler: @escaping ([CKDiscoveredUserInfo]?, Error?) -> Swift.Void)
    func discoverUserInfo(withEmailAddress email: String, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
    func discoverUserInfo(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKDiscoveredUserInfo?, Error?) -> Swift.Void)
}
extension CKContainer {
    func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareParticipant(withUserRecordID userRecordID: CKRecordID, completionHandler completionHandler: @escaping (CKShareParticipant, Error) -> Swift.Void)
    func fetchShareMetadata(with url: URL, completionHandler completionHandler: @escaping (CKShareMetadata, Error) -> Swift.Void)
    func accept(_ metadata: CKShareMetadata, completionHandler completionHandler: @escaping (CKShare, Error) -> Swift.Void)
}
extension CKContainer {
    func fetchAllLongLivedOperationIDs(completionHandler completionHandler: @escaping ([String]?, Error?) -> Swift.Void)
    func fetchLongLivedOperation(withID operationID: String, completionHandler completionHandler: @escaping (CKOperation?, Error?) -> Swift.Void)
}

Declaration
From
func requestApplicationPermission(_ applicationPermission: CKApplicationPermissions, completionHandler completionHandler: CloudKit.CKApplicationPermissionBlock)
To
func requestApplicationPermission(_ applicationPermission: CKApplicationPermissions, completionHandler completionHandler: @escaping CloudKit.CKApplicationPermissionBlock)

Declaration
From
func status(forApplicationPermission applicationPermission: CKApplicationPermissions, completionHandler completionHandler: CloudKit.CKApplicationPermissionBlock)
To
func status(forApplicationPermission applicationPermission: CKApplicationPermissions, completionHandler completionHandler: @escaping CloudKit.CKApplicationPermissionBlock)

Declaration
From
struct CKError {
    init(_nsError _nsError: NSError)
    static var _nsErrorDomain: String { get }
    enum Code : Int {
        typealias _ErrorType = CKError
        case internalError
        case partialFailure
        case networkUnavailable
        case networkFailure
        case badContainer
        case serviceUnavailable
        case requestRateLimited
        case missingEntitlement
        case notAuthenticated
        case permissionFailure
        case unknownItem
        case invalidArguments
        case resultsTruncated
        case serverRecordChanged
        case serverRejectedRequest
        case assetFileNotFound
        case assetFileModified
        case incompatibleVersion
        case constraintViolation
        case operationCancelled
        case changeTokenExpired
        case batchRequestFailed
        case zoneBusy
        case badDatabase
        case quotaExceeded
        case zoneNotFound
        case limitExceeded
        case userDeletedZone
        case tooManyParticipants
        case alreadyShared
        case referenceViolation
        case managedAccountRestricted
        case participantMayNeedVerification
    }
    static var internalError: CKError.Code { get }
    static var partialFailure: CKError.Code { get }
    static var networkUnavailable: CKError.Code { get }
    static var networkFailure: CKError.Code { get }
    static var badContainer: CKError.Code { get }
    static var serviceUnavailable: CKError.Code { get }
    static var requestRateLimited: CKError.Code { get }
    static var missingEntitlement: CKError.Code { get }
    static var notAuthenticated: CKError.Code { get }
    static var permissionFailure: CKError.Code { get }
    static var unknownItem: CKError.Code { get }
    static var invalidArguments: CKError.Code { get }
    static var resultsTruncated: CKError.Code { get }
    static var serverRecordChanged: CKError.Code { get }
    static var serverRejectedRequest: CKError.Code { get }
    static var assetFileNotFound: CKError.Code { get }
    static var assetFileModified: CKError.Code { get }
    static var incompatibleVersion: CKError.Code { get }
    static var constraintViolation: CKError.Code { get }
    static var operationCancelled: CKError.Code { get }
    static var changeTokenExpired: CKError.Code { get }
    static var batchRequestFailed: CKError.Code { get }
    static var zoneBusy: CKError.Code { get }
    static var badDatabase: CKError.Code { get }
    static var quotaExceeded: CKError.Code { get }
    static var zoneNotFound: CKError.Code { get }
    static var limitExceeded: CKError.Code { get }
    static var userDeletedZone: CKError.Code { get }
    static var tooManyParticipants: CKError.Code { get }
    static var alreadyShared: CKError.Code { get }
    static var referenceViolation: CKError.Code { get }
    static var managedAccountRestricted: CKError.Code { get }
    static var participantMayNeedVerification: CKError.Code { get }
    var partialErrorsByItemID: [NSObject : Error]? { get }
    var ancestorRecord: CKRecord? { get }
    var serverRecord: CKRecord? { get }
    var clientRecord: CKRecord? { get }
    var retryAfterSeconds: Double? { get }
}
extension CKError {
    var partialErrorsByItemID: [NSObject : Error]? { get }
    var ancestorRecord: CKRecord? { get }
    var serverRecord: CKRecord? { get }
    var clientRecord: CKRecord? { get }
    var retryAfterSeconds: Double? { get }
}
To
struct CKError {
    init(_nsError _nsError: NSError)
    static var _nsErrorDomain: String { get }
    enum Code : Int {
        typealias _ErrorType = CKError
        case internalError
        case partialFailure
        case networkUnavailable
        case networkFailure
        case badContainer
        case serviceUnavailable
        case requestRateLimited
        case missingEntitlement
        case notAuthenticated
        case permissionFailure
        case unknownItem
        case invalidArguments
        case resultsTruncated
        case serverRecordChanged
        case serverRejectedRequest
        case assetFileNotFound
        case assetFileModified
        case incompatibleVersion
        case constraintViolation
        case operationCancelled
        case changeTokenExpired
        case batchRequestFailed
        case zoneBusy
        case badDatabase
        case quotaExceeded
        case zoneNotFound
        case limitExceeded
        case userDeletedZone
        case tooManyParticipants
        case alreadyShared
        case referenceViolation
        case managedAccountRestricted
        case participantMayNeedVerification
    }
    static var internalError: CKError.Code { get }
    static var partialFailure: CKError.Code { get }
    static var networkUnavailable: CKError.Code { get }
    static var networkFailure: CKError.Code { get }
    static var badContainer: CKError.Code { get }
    static var serviceUnavailable: CKError.Code { get }
    static var requestRateLimited: CKError.Code { get }
    static var missingEntitlement: CKError.Code { get }
    static var notAuthenticated: CKError.Code { get }
    static var permissionFailure: CKError.Code { get }
    static var unknownItem: CKError.Code { get }
    static var invalidArguments: CKError.Code { get }
    static var resultsTruncated: CKError.Code { get }
    static var serverRecordChanged: CKError.Code { get }
    static var serverRejectedRequest: CKError.Code { get }
    static var assetFileNotFound: CKError.Code { get }
    static var assetFileModified: CKError.Code { get }
    static var incompatibleVersion: CKError.Code { get }
    static var constraintViolation: CKError.Code { get }
    static var operationCancelled: CKError.Code { get }
    static var changeTokenExpired: CKError.Code { get }
    static var batchRequestFailed: CKError.Code { get }
    static var zoneBusy: CKError.Code { get }
    static var badDatabase: CKError.Code { get }
    static var quotaExceeded: CKError.Code { get }
    static var zoneNotFound: CKError.Code { get }
    static var limitExceeded: CKError.Code { get }
    static var userDeletedZone: CKError.Code { get }
    static var tooManyParticipants: CKError.Code { get }
    static var alreadyShared: CKError.Code { get }
    static var referenceViolation: CKError.Code { get }
    static var managedAccountRestricted: CKError.Code { get }
    static var participantMayNeedVerification: CKError.Code { get }
    var partialErrorsByItemID: [AnyHashable : Error]? { get }
    var ancestorRecord: CKRecord? { get }
    var serverRecord: CKRecord? { get }
    var clientRecord: CKRecord? { get }
    var retryAfterSeconds: Double? { get }
}
extension CKError {
    var partialErrorsByItemID: [AnyHashable : Error]? { get }
    var ancestorRecord: CKRecord? { get }
    var serverRecord: CKRecord? { get }
    var clientRecord: CKRecord? { get }
    var retryAfterSeconds: Double? { get }
}

Declaration
From
var partialErrorsByItemID: [NSObject : Error]? { get }
To
var partialErrorsByItemID: [AnyHashable : Error]? { get }

Feedback