/SwAlert

Wrapper of UIAlertView & UIAlertController. (Swift-lang)

Primary LanguageSwiftMIT LicenseMIT

SwAlert

Version License Swift 4.0 Platforms iOS Xcode 9.1

Wrapper of UIAlertController. written in Swift.

Usage

Show No Action Alert

SwAlert.showAlert("no action title", message: "no action message", buttonTitle: "button title")

Show Simple Action Alert and CompletionHandler

SwAlert.showAlert("one action title", message: "no action message", buttonTitle: "button title") { result in
    println("showOneActionAlert completion")
}

Show Some Action Alert and CompletionHandler

SwAlert(title: "double action title", message: "double action message")
    .addAction("double action 1") { result in
        println("double action 1 completion")
    }
    .setCancelAction("cancel action") { result in
        println("cancel action completion")
    }
    .show()

Show Textfield Action Alert and CompletionHandler

SwAlert(title: "text action title", message: "text action message")
    .addTextField("text action 1 title", placeholder: "text action 1 placeholder")
    .addTextField("text action 2 title", placeholder: "text action 2 placeholder")
    .addAction("text action") { result in
        println(result) // Other(["text action 1 title", "text action 2 title"])
    }
    .show()

Objc Version

ARNAlert

Requirements

  • iOS 9.0+
  • Xcode 9.1+
  • Swift 4.0+
  • CocoaPods 1.3.0+

Installation

use_frameworks!

pod "SwAlert"

License

MIT license. See the LICENSE file for more info.