Swiftpack.co -  Package - bryanbarreto/easy-alert
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
bryanbarreto/easy-alert
Simple Swift lib for showing alerts on Screen
.package(url: "https://github.com/bryanbarreto/easy-alert.git", from: "1.0")

EasyAleert

EasyAleert is a simple Swift library for show native Alerts.

Installation

Use the Swift Package Manager to install EasyAleert.

https://github.com/bryanbarreto/easy-alert

Usage

import EasyAleert

/* Crie uma extension da sua UIViewController e implemente o protocolo EasyAleertDelegate e exiba o alert em sua tela */
extension ViewController: EasyAlertDelegate {
    func show(_ alert: UIAlertController) {
        self.present(alert, animated: true, completion: nil)
    }
}


/* Para exibir um alert na tela, utilize uma dessas funções */

/* Exibe um alerta de sucesso, erro ou warning */
func showAlert(){
    self.easyAlert?.showMessageAlert("Minha Mensagem", style: .success, onDissmiss: nil)
}

/* Exibe um alert de confirmação, com callbacks para os botões de OK e Cancelar */
func showConfirmation(){
    self.easyAlert?.showConfirmationAlert(title: "Título", message: "Mensagem", okCompletion: nil, cancelCompletion: nil)
}

/* Exibe um toast na tela, podendo alterar a sua duração */
func showToast(){
    self.easyAlert?.showToast("Meu Toast", duration: 2)
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

GitHub

link
Stars: 1
Last commit: 2 weeks ago

Release Notes

Versão 1.0
2 weeks ago

Versão 1.0 do EasyAleert

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco