try?

We can use try? to handle an error by converting it to an optional value.

If an error is thrown while evaluating the try? expression, the value of the expression is going to be nil. For instance, in the following example, the result is going to be nil if we cannot read the file:

let result = try? readFile(path: "path/to") 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset