Swift Functions โ Handling Errors with do, try, and catch ๐จ (opens in new tab)
So far in this series, our functions have either worked correctly or... not really had a way to say "something went wrong" beyond returning a weird value or crashing. Swift has a proper system for this, and it's built around three keywords that always travel together: do, try, and catch. ๐ฅ Setting Up: Defining Possible Errors Imagine we're building a guild registration system for an anime-style RPG, and we need to check whether a player's chosen guild name is acceptable. Some names should be ...
Read the original article