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