Skip to content

Instantly share code, notes, and snippets.

@clayellis
Created May 29, 2018 19:27
Show Gist options
  • Save clayellis/25ba62fd6d5eb5fb0c3faaa2d3b822a3 to your computer and use it in GitHub Desktop.
Save clayellis/25ba62fd6d5eb5fb0c3faaa2d3b822a3 to your computer and use it in GitHub Desktop.
Debug descriptions for CloudKit enums
import CloudKit
extension CKAccountStatus: CustomDebugStringConvertible {
public var debugDescription: String {
switch self {
case .available:
return "Available"
case .noAccount:
return "No Account"
case .restricted:
return "Restricted"
case .couldNotDetermine:
return "Could Not Determine"
}
}
}
extension CKError.Code: CustomDebugStringConvertible {
public var debugDescription: String {
switch self {
case .alreadyShared:
return "Already Shared"
case .assetFileModified:
return "Asset File Modified"
case .assetFileNotFound:
return "Asset File Not Found"
case .assetNotAvailable:
return "Asset Not Available"
case .badContainer:
return "Bad Container"
case .badDatabase:
return "Bad Database"
case .batchRequestFailed:
return "Batch Request Failed"
case .changeTokenExpired:
return "Change Token Expired"
case .constraintViolation:
return "Constraint Violation"
case .incompatibleVersion:
return "Incompatible Version"
case .internalError:
return "Internal Error"
case .invalidArguments:
return "Invalid Arguments"
case .limitExceeded:
return "Limit Exceeded"
case .managedAccountRestricted:
return "Managed Account Restricted"
case .missingEntitlement:
return "Missing Entitlement"
case .networkFailure:
return "Network Failure"
case .networkUnavailable:
return "Network Unavailable"
case .notAuthenticated:
return "Not Authenticated"
case .operationCancelled:
return "Operation Cancelled"
case .partialFailure:
return "Partial Failure"
case .participantMayNeedVerification:
return "Participant May Need Verification"
case .permissionFailure:
return "Permission Failure"
case .quotaExceeded:
return "Quota Exceeded"
case .referenceViolation:
return "Reference Violation"
case .requestRateLimited:
return "Request Rate Limited"
case .resultsTruncated:
return "Results Truncated"
case .serverRecordChanged:
return "Server Record Changed"
case .serverRejectedRequest:
return "Server Rejected Request"
case .serverResponseLost:
return "Server Response Lost"
case .serviceUnavailable:
return "Service Unavailable"
case .tooManyParticipants:
return "Too Many Participants"
case .unknownItem:
return "Unknown Item"
case .userDeletedZone:
return "User Deleted Zone"
case .zoneBusy:
return "Zone Busy"
case .zoneNotFound:
return "Zone Not Found"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment