With Swift now some functions are marked with throws, and this force the developers to call the function inside a do - try catch block. But how the
throws
do - try catch
You write a pattern after catch to indicate what errors that clause can handle.
do { try expression statements } catch pattern 1 { statements } catch pattern 2 where condition { statements }
See section Handling Errors Using Do-Catch of Swift Programming Language