Reading List

Pattern Matching on Swift Error Codes from Michael Tsai RSS feed.

Pattern Matching on Swift Error Codes

Ole Begemann: I was wondering why this shorter syntax works. Is there some special compiler magic for pattern matching against error codes of NSError instances? Turns out: no, the answer is much simpler. Foundation includes an overload for the pattern matching operator ~= that matches error values against error codes.The implementation looks something like this:public […]