Tag: errors
-
Launch an Alert from a Closure Safely
Your app can get into problems when you launch UI from others threads, such as closures. For example, you might have an app that going to ask for permissions for things like photos, notifications, or location data. The system usually handles those, but you might want to be even more exclusive on what to use,…
-
Understand ARC
One of those difficult things for even experienced developers to understand is Automatic Reference Counting, or ARC. It is how Swift manages and conserves memory automatically. Take a look at the Exercise file. I have a playground in this project with two classes. One is a pizza topping. One is a Pizza. Look at the…
-
Thrown Errors
There’s many ways to handle errors in Swift. For some errors, using throws is a great way to handle errors without crashing the system. Download the exercise file. You’ll find a project with an embedded playground. While there’s a lot better ways to do this, I’ll use an example of a function coffee(name:) that finds…