Lightweight helper for working with UIAlertController
Alert(title: "Info", message: "Wow")
.button("Ok") { print("Ok") }
.cancel("Cancel")
.show()It's function with optional style and closure parameters.
title: Stringaction: (() -> Void)?
Add empty button with default style and empty action
.button("Empty button")For common .default style
.button("Ok") { print("Ok button pressed") }... for .cancel
.cancel("Cancel")and .destructive
.destructive("Delete") { print("Delete") }Show your alert everywhere
This function looking for top view controller and show alert controller on it
on viewController: UIViewController?animated: Boolcompletion: (() -> Void)?
viewController = nilanimated = truecompletion = nil
Most common
.show()If you want present alert on current viewController p.s. This way will save time to search top view controller
.show(on: self).show(on:self, animated: false).show(on:self, animated: false) { print("Poof") }