From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Launch an alert from a closure and what to do about it

Launch an alert from a closure and what to do about it

From the course: iOS Development Tips

Launch an alert from a closure and what to do about it

- [Instructor] Your app can get into problems when you launch UI from other threads, such as closures. For example, you might have an app that is 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, and use your own alert. In this tip, I'll show you how to launch an alert from closure. I'll use a slightly modified exercise file from the IOS and Watch OS app development notifications course I have in the library. If you haven't seen the course yet, notifications need permissions. And in that exercise file, I show you how to set up permissions. Since the demo app requires notifications, if the user prohibits notifications, I want the app to tell them that's a problem. If you go to the view controller dot swift file, I need an alert method access denied alert for that purpose. I edit two actions here. The first is an okay action, which will do nothing but…

Contents