Code
The error code itself.
- iOS
- 8.0+
- macOS
- 10.10+
- tvOS
- 9.0+
- watchOS
- 2.0+
struct Code
The error code itself.
struct Code
import FoundationEssentials
struct CocoaError
Describes errors within the Cocoa error domain, including errors that Foundation throws.
init(_ code: CocoaError.Code, userInfo: [String : Any] = [:])
static var errorDomain: String { get }
static var executableArchitectureMismatch: CocoaError.Code { get }
static var executableLink: CocoaError.Code { get }
static var executableLoad: CocoaError.Code { get }
static var executableNotLoadable: CocoaError.Code { get }
static var executableRuntimeMismatch: CocoaError.Code { get }
static var featureUnsupported: CocoaError.Code { get }
static var fileLocking: CocoaError.Code { get }
static var fileManagerUnmountBusy: CocoaError.Code { get }
static var fileManagerUnmountUnknown: CocoaError.Code { get }
static var fileNoSuchFile: CocoaError.Code { get }
static var fileReadCorruptFile: CocoaError.Code { get }
static var fileReadInapplicableStringEncoding: CocoaError.Code { get }
static var fileReadInvalidFileName: CocoaError.Code { get }
static var fileReadNoPermission: CocoaError.Code { get }
static var fileReadNoSuchFile: CocoaError.Code { get }
static var fileReadTooLarge: CocoaError.Code { get }
static var fileReadUnknown: CocoaError.Code { get }
static var fileReadUnknownStringEncoding: CocoaError.Code { get }
static var fileReadUnsupportedScheme: CocoaError.Code { get }
static var fileWriteFileExists: CocoaError.Code { get }
static var fileWriteInapplicableStringEncoding: CocoaError.Code { get }
static var fileWriteInvalidFileName: CocoaError.Code { get }
static var fileWriteNoPermission: CocoaError.Code { get }
static var fileWriteOutOfSpace: CocoaError.Code { get }
static var fileWriteUnknown: CocoaError.Code { get }
static var fileWriteUnsupportedScheme: CocoaError.Code { get }
static var fileWriteVolumeReadOnly: CocoaError.Code { get }
static var formatting: CocoaError.Code { get }
static var keyValueValidation: CocoaError.Code { get }
static var propertyListReadCorrupt: CocoaError.Code { get }
static var propertyListReadStream: CocoaError.Code { get }
static var propertyListReadUnknownVersion: CocoaError.Code { get }
static var propertyListWriteInvalid: CocoaError.Code { get }
static var propertyListWriteStream: CocoaError.Code { get }
static var userCancelled: CocoaError.Code { get }
static func error(_ code: CocoaError.Code, userInfo: [String : AnyHashable]? = nil, url: URL? = nil) -> any Error
let code: CocoaError.Code
var filePath: String? { get }
The file path associated with the error, if any.
var isCoderError: Bool { get }
var isExecutableError: Bool { get }
var isFileError: Bool { get }
var isFormattingError: Bool { get }
var isPropertyListError: Bool { get }
var isValidationError: Bool { get }
var stringEncoding: String.Encoding? { get }
The string encoding associated with this error, if any.
var underlying: (any Error)? { get }
The underlying error behind this error, if any.
var underlyingErrors: [any Error] { get }
A list of underlying errors, if any. It includes the values of both NSUnderlyingErrorKey and NSMultipleUnderlyingErrorsKey. If there are no underlying errors, returns an empty array.
var url: URL? { get }
The URL associated with this error, if any.
nonisolated(unsafe) let userInfo: [String : Any]
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol Sendable
init(rawValue: Int)
static var executableArchitectureMismatch: CocoaError.Code { get }
static var executableLink: CocoaError.Code { get }
static var executableLoad: CocoaError.Code { get }
static var executableNotLoadable: CocoaError.Code { get }
static var executableRuntimeMismatch: CocoaError.Code { get }
static var featureUnsupported: CocoaError.Code { get }
static var fileLocking: CocoaError.Code { get }
static var fileManagerUnmountBusy: CocoaError.Code { get }
static var fileManagerUnmountUnknown: CocoaError.Code { get }
static var fileNoSuchFile: CocoaError.Code { get }
static var fileReadCorruptFile: CocoaError.Code { get }
static var fileReadInapplicableStringEncoding: CocoaError.Code { get }
static var fileReadInvalidFileName: CocoaError.Code { get }
static var fileReadNoPermission: CocoaError.Code { get }
static var fileReadNoSuchFile: CocoaError.Code { get }
static var fileReadTooLarge: CocoaError.Code { get }
static var fileReadUnknown: CocoaError.Code { get }
static var fileReadUnknownStringEncoding: CocoaError.Code { get }
static var fileReadUnsupportedScheme: CocoaError.Code { get }
static var fileWriteFileExists: CocoaError.Code { get }
static var fileWriteInapplicableStringEncoding: CocoaError.Code { get }
static var fileWriteInvalidFileName: CocoaError.Code { get }
static var fileWriteNoPermission: CocoaError.Code { get }
static var fileWriteOutOfSpace: CocoaError.Code { get }
static var fileWriteUnknown: CocoaError.Code { get }
static var fileWriteUnsupportedScheme: CocoaError.Code { get }
static var fileWriteVolumeReadOnly: CocoaError.Code { get }
static var formatting: CocoaError.Code { get }
static var keyValueValidation: CocoaError.Code { get }
static var propertyListReadCorrupt: CocoaError.Code { get }
static var propertyListReadStream: CocoaError.Code { get }
static var propertyListReadUnknownVersion: CocoaError.Code { get }
static var propertyListWriteInvalid: CocoaError.Code { get }
static var propertyListWriteStream: CocoaError.Code { get }
static var userCancelled: CocoaError.Code { get }
let rawValue: Int
var hashValue: Int { get }
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
func hash(into hasher: inout Hasher)
import Foundation
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Escapable
static var coderInvalidValue: CocoaError.Code { get }
static var coderReadCorrupt: CocoaError.Code { get }
static var coderValueNotFound: CocoaError.Code { get }
static var ubiquitousFileNotUploadedDueToQuota: CocoaError.Code { get }
static var ubiquitousFileUbiquityServerNotAvailable: CocoaError.Code { get }
static var ubiquitousFileUnavailable: CocoaError.Code { get }
static var userActivityConnectionUnavailable: CocoaError.Code { get }
static var userActivityHandoffFailed: CocoaError.Code { get }
static var userActivityHandoffUserInfoTooLarge: CocoaError.Code { get }
static var userActivityRemoteApplicationTimedOut: CocoaError.Code { get }
static var xpcConnectionInterrupted: CocoaError.Code { get }
static var xpcConnectionInvalid: CocoaError.Code { get }
static var xpcConnectionReplyInvalid: CocoaError.Code { get }