mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SE-0112] Add typed accessors for various error types and keys.
Introduce typed accesses for the error types of AVFoundation, CloudKit, Contacts, and CoreLocation. While here, fix the API notes for the Contacts framework, which had an embarrassingly-wrong file name ;)
This commit is contained in:
7
stdlib/public/SDK/CloudKit/CMakeLists.txt
Normal file
7
stdlib/public/SDK/CloudKit/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
add_swift_library(swiftCloudKit ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
|
||||
CloudKit.swift
|
||||
TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR WATCHOS WATCHOS_SIMULATOR
|
||||
SWIFT_MODULE_DEPENDS Foundation CoreLocation
|
||||
SWIFT_MODULE_DEPENDS_OSX Contacts
|
||||
SWIFT_MODULE_DEPENDS_IOS Contacts
|
||||
FRAMEWORK_DEPENDS_WEAK CloudKit)
|
||||
36
stdlib/public/SDK/CloudKit/CloudKit.swift
Normal file
36
stdlib/public/SDK/CloudKit/CloudKit.swift
Normal file
@@ -0,0 +1,36 @@
|
||||
@_exported import CloudKit
|
||||
import Foundation
|
||||
|
||||
@available(macOS 10.10, iOS 8.0, *)
|
||||
extension CKErrorCode {
|
||||
/// Retrieve partial error results associated by item ID.
|
||||
public var partialErrorsByItemID: [NSObject : Error]? {
|
||||
return userInfo[CKPartialErrorsByItemIDKey] as? [NSObject : Error]
|
||||
}
|
||||
|
||||
/// The original CKRecord object that you used as the basis for
|
||||
/// making your changes.
|
||||
public var ancestorRecord: CKRecord? {
|
||||
return userInfo[CKRecordChangedErrorAncestorRecordKey] as? CKRecord
|
||||
}
|
||||
|
||||
/// The CKRecord object that was found on the server. Use this
|
||||
/// record as the basis for merging your changes.
|
||||
public var serverRecord: CKRecord? {
|
||||
return userInfo[CKRecordChangedErrorServerRecordKey] as? CKRecord
|
||||
}
|
||||
|
||||
/// The CKRecord object that you tried to save. This record is based
|
||||
/// on the record in the CKRecordChangedErrorAncestorRecordKey key
|
||||
/// but contains the additional changes you made.
|
||||
public var clientRecord: CKRecord? {
|
||||
return userInfo[CKRecordChangedErrorClientRecordKey] as? CKRecord
|
||||
}
|
||||
|
||||
/// The number of seconds after which you may retry a request. This
|
||||
/// key may be included in an error of type
|
||||
/// `CKErrorServiceUnavailable` or `CKErrorRequestRateLimited`.
|
||||
public var retryAfterSeconds: Double? {
|
||||
return userInfo[CKErrorRetryAfterKey] as? Double
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user