Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bigimot22's full-sized avatar
💭
Creating iOS Dev courses to raise people up

Johandre Delgado bigimot22

💭
Creating iOS Dev courses to raise people up
View GitHub Profile
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.
@bigimot22
bigimot22 / AlertaSimple.swift
Last active March 3, 2019 09:18
Un ejemplo de una simple alerta con dos botones en Swift
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)
}
@bigimot22
bigimot22 / CellDequeuer.swift
Created February 2, 2019 08:43
Cool way to dequeue reusable Tableview cells.
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: