From “Result” to “throw” and Back
Problem is,
Result
is not built in the Swift standard library, and a lot of functions usethrow
to report synchronous errors anyway. Like in practice, to build aUser
from aNSDictionary
we might have ainit(dict: NSDictionary) throws
constructor instead of aNSDictionary -> Result<User>
function.So how to mix both those worlds? Easy: let’s extend
Result
just for that!