Matching and Bridging NSErrors in Swift
You can find all the gory details in SE-0112, but the long and the short of it is, depending on the
domain
of a givenNSError
, Swift automatically bridges it to a struct describing that domain. In the case ofNSURLErrorDomain
, for example, Swift will bridge to a URLError[…]
You can also use the CustomNSError protocol to bridge in the other direction.
See also: CocoaError.