Latest 0.0.1
Homepage https://github.com/GlobakMaxim/Alert
License MIT
Platforms ios 10.0
Authors

Alert

Syntactic sugar for UIAlertController

UIAlertController with beautiful API

Alert(title: "Info", message: "Wow")
.button("Ok") { print("Ok") }
.cancel("Cancel")
.show()

.button()

It’s function with optional style and closure parameters.

parameters

  • title: String
  • action: (() -> Void)?
How to use

Add empty button with default style and empty action

.button("Empty button")
For each style has its own function

For common .default style

.button("Ok") { print("Ok button pressed") }

… for .cancel

.cancel("Cancel")

and .destructive

.destructive("Delete") { print("Delete") }

.show()

Show your alert everywhere

This function looking for top view controller and show alert controller on it

parameters

  • on viewController: UIViewController?
  • animated: Bool
  • completion: (() -> Void)?

default parameters

  • viewController = nil
  • animated = true
  • completion = nil
How to use

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") }

Latest podspec

{
    "name": "SugarAlert",
    "version": "0.0.1",
    "summary": "Syntactic sugar for UIAlertController.",
    "description": "Add-on for UIAlertController with declarative interface for more convenient and pleasant work with Alert and ActionSheet.",
    "homepage": "https://github.com/GlobakMaxim/Alert",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Maxim": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/GlobakMaxim/Alert.git",
        "tag": "0.0.1"
    },
    "source_files": "Source",
    "exclude_files": "Classes/Exclude"
}

Pin It on Pinterest

Share This