RSSAmplifier

Ole Begemann · Feb 27, 2023

Pattern matching on error codes

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Foundation overloads the pattern matching operator ~= to enable matching against error codes in catch clauses. catch clauses in Swift support pattern matching, using the same patterns you’d use in a case clause inside a switch or in an if case … statement. For example, to handle a file-not-found error you might write: import Foundation do { let fileURL = URL ( filePath : "/abc" ) // non-existent…

Read on oleb.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.