Follow Us on Apple News

Now that 2019 is here, Apple Developers eagerly wait for Apple to announce when its annual WWDC will be.

A web site called InfoQ seems to have inside information about what Apple is prepping for the yet to be announced Swift 5.

According to the article:

One of the most awaited proposals for Swift 5, Result, has already landed into the language. The Result type forces the programmer to explicitly handle the failure and success cases before they can gain access to the actual value. Let’s have a look at how it is implemented, how you can use it, and why it was needed.

The Result type is meant to enforce a safe way to handle errors returned by a function call without resorting to exceptions. While exceptions provide an automatic mechanism for error propagation and handling, Result provides a manual mechanism with stronger type guarantees and more suitable to async error handling. Similarly to the Option type, the Result type is a monad.

To to read the rest of the article, click here.