This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func showMyAlert() { | |
//1 | |
let alerta = UIAlertController(title: "Mi título", message: "Mi mensaje para el usuario.", preferredStyle: .alert) | |
//2 | |
alerta.addAction(UIAlertAction(title: "Aceptar", style: .default, handler: nil)) | |
//3 | |
self.present(alerta, animated: true) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UITableView { | |
func dequeueReusableCell<T: UITableViewCell>() -> T { | |
return dequeueReusableCell(withIdentifier: NSStringFromClass(T.self)) as! T | |
} | |
} | |
//To use it, you declare a cell as follow: |