Latest 1.0.0
Homepage https://github.com/HsoiEnterprises/HEAlert
License BSD 3-clause “New” or “Revised”
Platforms ios 8.0, requires ARC
Authors

Build Status
Cocoapods Compatible
License
Platform

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")
  alertView.show()

or:

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

to:

HEAlert.ok("Hello World")

or:

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

Supported OS and SDK

  • Xcode 8.0+
  • Swift 3+
  • iOS 8 (minimum, required)

With v1.0, HEAlert has moved to Swift 3 and Xcode 8. If you need need Swift 2.2 support, use the v0.5.3 tag. There has been no explicit effort to support Swift 2.3.

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.

Installation

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

Submodule

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

Cocoapods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate HEAlert into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'HEAlert'

Then, run the following command:

$ pod install

Usage

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

or:

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

NSError

Easy display of an NSError:

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

Contact

Hsoi Enterprises

Creator

Changes / Release Notes

See included CHANGELOG.md file.

License

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

Latest podspec

{
    "name": "HEAlert",
    "version": "1.0.0",
    "homepage": "https://github.com/HsoiEnterprises/HEAlert",
    "source": {
        "git": "https://github.com/HsoiEnterprises/HEAlert.git",
        "tag": "v1.0.0"
    },
    "summary": "A convenience around UIAlertController, because sometimes you just want to say "OK".",
    "authors": {
        "John C. Daub (@hsoi)": "[email protected]"
    },
    "social_media_url": "https://twitter.com/hsoienterprises",
    "description": "UIAlertController is awesome, but sometimes it's too much. How many times do you simply alert with a message and an "OK" button? Easy with UIAlertView, but cumbersome with UIAlertController.nnThat's why I created HEAlert.",
    "requires_arc": true,
    "license": {
        "type": "BSD 3-clause u201cNewu201d or u201cRevisedu201d",
        "file": "LICENSE"
    },
    "source_files": [
        "HEAlert/*.swift",
        "HEAlert/*.h"
    ],
    "platforms": {
        "ios": "8.0"
    },
    "module_name": "HEAlert"
}

Pin It on Pinterest

Share This