Check out example codes for "IOS create UIAlertViewController programmatically". It will help you in understanding the concepts better.

Code Example 1

let alertController = UIAlertController(title: "Some Error",
                                               message: "Pleas confirm?",
                                               preferredStyle: .alert)

  let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
            alertController.addAction(defaultAction)

  self?.present(alertController, animated: true, completion: nil)

Learn ReactJs, React Native from akashmittal.com