Swift: How to create alerts using UIAlertController?

UIAlertController is an object for displaying alerts to the user. We can configure alerts and action sheets with a custom message for the user and actions from which to choose. After configuring the alert, we have to present it using present(_:animated:,completion:) method. UIAlertAction is used to define the type of actions to be associated with our alerts.  addAction method is used to add actions to our custom alert.

 

Leave a Reply