Skip to content

Instantly share code, notes, and snippets.

@bigimot22
Created March 3, 2019 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigimot22/1beab29fd2f1ceb1678e0c774a9efd28 to your computer and use it in GitHub Desktop.
Save bigimot22/1beab29fd2f1ceb1678e0c774a9efd28 to your computer and use it in GitHub Desktop.
func showMyAlert() {
//1
let alerta = UIAlertController(title: "Mi título", message: "Mi mensaje para el usuario.", preferredStyle: .alert)
//2
alerta.addAction(UIAlertAction(title: "Cerrar", style: .default, handler: nil))
//3:
//Acción con función en linea (closure)
alerta.addAction(UIAlertAction(title: "Otra opción", style: .default, handler: { miAccion in
// escribir debajo la funcionalidad deseada.
print("Hemos escogido otra opción") }))
//4
self.present(alerta, animated: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment