Swiftpack.co - bryanbarreto/easy-alert as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by bryanbarreto.
bryanbarreto/easy-alert 1.0
Simple Swift lib for showing alerts on Screen
⭐️ 1
🕓 3 years ago
.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: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Versão 1.0
3 years ago

Versão 1.0 do EasyAleert

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