Matching NSErrors

Joshua Emmons shows us how to easily pattern match NSErrors in Swift. It transpires that since Swift 3, NSErrors are bridged to Swift error structs, and when combined with the pattern matching operator (~=), this allows us to deal with NSErrors in a much more declarative way.