Catching errors Swift 5.1 Posted by Gerard Grundy Date January 25, 2020 Comments 0 comment Sometimes a function you have in your program may be causing errors. All you have to do is add throws after the function and then place the function in a do catch statement with try. Check out the code below:func mayCauseAnError() throws { } do { try mayCauseAnError() } catch { print(error) }If anything happens with the try then it will print an error in the catch. Related Tag:Learn Swift Programming|Swift Programming|Swift Tutorials Share: Gerard Grundy Previous post Error catching Swift 5.1 January 25, 2020 Next post What are basic operators Swift 5.1 January 26, 2020 You may also like Argument passed to call that takes no arguments SwiftUI 5.1 February 15, 2020 Custom Text is being cut off at the top SwiftUI 5.1 February 10, 2020 Comparison Operator Swift 5.1 Challenge January 31, 2020