Handling errors

- If you've been following along with this course…in the order presented…and followed my suggestion in the Control Flow chapter…to watch the video on enumerations beforehand,…you will be well-versed with creating enumerations,…and will find nothing new here.…I will be creating an enumeration in this video…for use in demonstrating error handling in Swift.…The syntax is straightforward,…but if you haven't watched the video on enumerations yet…and would like to do so,…feel free to pause this video,…go to the chapter on classes, structures, and enumerations,…and watch the video Working with Enumerations,…and then come back here and continue on.…

Sometimes functions can encounter errors.…Swift enables you to write preemptive code…to handle errors that can be recovered from,…instead of your app crashing.…Functions that can encounter recoverable errors…are referred to as throwing functions.…And when they encounter such a problem,…they throw an error.…Handling these errors in Swift…begins with how you define functions…

Resume Transcript Auto-Scroll

Author

Released

11/5/2015

Apple introduced Swift in June 2014, describing it as Objective-C without the C. Yet with version 2, announced in June 2015, Swift is pulling away from its Objective-C origins and breaking new ground as a modern language that is safe, fast, and expressive. In this training course, Scott Gardner will take you through each component of the language, explaining what you need to know to become proficient in programming with Swift, from concepts to hands-on coding. Scott covers data types, control statements, functions, classes and structures, and much more.

Completing this course will prepare you to use Swift to develop apps for iPhone and iPad, Mac, Apple Watch, and Apple TV.