HEAlert 1.0.0

HEAlert 1.0.0

LangLanguage SwiftSwift
License BSD 3.0
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by John Daub, John C. Daub.

HEAlert 1.0.0


A convenience around UIAlertController, because sometimes you just want to say “OK”.

Background and Approach

UIAlertController is awesome, but sometimes it’s too much. How many times do you want to simply alert with a message and an “OK” button? Somewhat easy with UIAlertView, certainly cumbersome with UIAlertController, but simple with HEAlert.

That’s why I created HEAlert.

Go from:

  let alertView = UIAlertView(title: "Hello World", message: nil, delegate: nil, cancelButtonTitle: "OK")


let alertController = UIAlertController(title: "Hello World", message: nil, preferredStyle: .Alert)
let action = UIAlertAction(title: "OK", style: .Default, handler: nil)
self.presentViewController(alertController, animated: true, completion: nil)


HEAlert.ok("Hello World")


HEAlert.ok("Hello World", presentingViewController: self)

Supported OS and SDK

  • Xcode 7.2.1+
  • Swift 2.1+
  • iOS 8 (minimum, required)

With v0.5, HEAlert has moved to Swift 2 and Xcode 7. If you still need Xcode 6.x (Swift 1.2) support, you can use older versions of HEAlert such as v0.4.2.


Currently supports being installed by simple source code addition, by git submodule, or by Cocoapods (preferred).


You can easily obtain git as a submodule, and simply add HEAlert.swift to your project. Off you go!


Usage is fairly straightforward, and the code is fully documented. There’s also an example application that demonstrates a simple usage of the class.

Simple OK alert

HEAlert.ok("Hello World")


HEAlert.ok("Hello World", presentingViewController: self)

OK with Message

HEAlert.ok("Hello World", message: "This is my first HEAlert", presentingViewController: self)

More Complicated

You can customize a fair portion of the HEAlert behaviors:

HEAlert.other("Do you like waffles?", message: "This is an important question", buttonTitle: "Yes", cancelTitle: "No", presentingViewController: self, cancelHandler: { (_) -> Void in
    println("Must like pancakes instead")
}) { (_) -> Void in
    println("Get the syrup!")


Easy display of an NSError:

HEAlert.error(anNSError, presentingViewController: self, buttonHandler: nil)


Hsoi Enterprises


Changes / Release Notes

See included CHANGELOG.md file.


BSD 3-clause “New” or “Revised” License. See included “License” file.