Monday, February 8, 2016 [Tweets] [Favorites]

From “Result” to “throw” and Back

Olivier Halligon:

Problem is, Result is not built in the Swift standard library, and a lot of functions use throw to report synchronous errors anyway. Like in practice, to build a User from a NSDictionary we might have a init(dict: NSDictionary) throws constructor instead of a NSDictionary -> Result<User> function.

So how to mix both those worlds? Easy: let’s extend Result just for that!

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment