TechNewsHeaven {{source.name}}




The power of Result types in Swift
2018-06-17T23:52:55.0062361Z - / Hacker News
An example of such a type is the Result type - and while it's not (yet) built into the standard library, it's a type which is very commonly seen in many different Swift projects. This week, let's explore various versions of such a result type, and some of the cool things it lets us do when combined with some of Swift's language features. ThrowingSometimes we don't really want to switch on a result, but rather hook it directly into Swift's do, try, catch error handling model. 👍ConclusionUsing a Result type can be a great way to reduce ambiguity when dealing with values and results of asynchronous operations. Another thing that can be a bit of a challenge with result types in their current state is when multiple frameworks or modules each define their own result type, and we end up having to convert between them in our app code.

Your favorite news


Popular news




Recommended news