Swift handles this exact problem quite elegantly with the "if case let" construct, allowing you to destructure sum types directly within an if statement.
https://alisoftware.github.io/swift/pattern-matching/2016/05...
https://alisoftware.github.io/swift/pattern-matching/2016/05...
No comments yet.