Showing AlertControllers (Alerts) on the screen

There are times when you want your application to inform the user about something, or maybe you want to show an error in a delicate manner, other than simply crashing the app due to unhandled exceptions. The AlertControllers (formerly known as Alert Views) are easy to implement, customizable and native. They blend in with the iOS style as they are pretty much used all across iOS for various stuff, and they make your application to feel way better when used.

Let's take this example:

Your application has a feature that should load and play a video from a link. The user is not connected to the internet. A poorly made application would crash due to the exception (or in a perfect world, would remain alive but do nothing on the screen). What can you do? Well, you can try to see if the user is connected to the internet by any means first, and if he is not, you can take advantage of such AlertController to prompt them to get online, this way you won't have an app that either does nothing or crashes instantly.

Another use for these alerts can be simply informing the user about a new update or whatnot, they are usable for absolutely any info you may want to quickly present in an elegant manner to the user.

More developer documentation:

Download playground

Complete and Continue  
Discussion

1 comments