PKError
public protocol PKError : CustomStringConvertible, Error
-
The error domain (used for creating
NSError)Declaration
Swift
static var domain: String { get } -
The error code. use
switch selfto retrieve the value in enums.var code: Int { switch self { case .one: return 1 case .two: return 2 } }Declaration
Swift
var code: Int { get } -
The error description.
Declaration
Swift
var errorDescription: String { get } -
Dictionary object to hold all params of the case.
Should take all associated values and create a dictionary for them.
For example in enum error when we have 2 cases:
- .one(error: NSError, url: URL)
- .two(error: NSError))
var userInfo: [String : Any] { switch self { case .one(let rootError, let url): return ["root": rootError, "url": url] case .two(let rootError): return ["root": rootError] } }Declaration
Swift
var userInfo: [String : Any] { get } -
asNSErrorDefault implementationcreates an
NSErrorfrom the selected case.Default Implementation
creates an
NSErrorfrom the selected case.Declaration
Swift
var asNSError: NSError { get }
-
descriptionExtension methoddescription string
Declaration
Swift
public var description: String { get }
-
descriptionExtension methodDeclaration
Swift
var description: String { get }
PKError Protocol Reference