gonzalonunez / GNAlertConveniences

A UIViewController extension designed to simplify your life when presenting a UIAlertController.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GNAlertConveniences

Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

GNAlertConveniences extends UIViewController with a few handy methods to help present basic UIAlertControllers without all the boilerplate code.

Note: The button titles come localized, but the UIAlertController title and message must be localized before being passed into these methods.

Methods

public func showAlertControllerWithTitle(title:String, message:String, okActionBlock:GNVoidCompletionBlock? = nil)

This will show a UIAlertController with one button titled "Ok". This button calls the okActionBlock.

public func showAlertControllerWithTitle(title:String, message:String, okActionBlock:GNVoidCompletionBlock, cancelActionBlock:GNVoidCompletionBlock? = nil)

This will show a UIAlertController with two buttons. One of these buttons is titled "Ok", and the other is titled "Cancel". This is useful when the user is presented the controller as a means of either confirming or cancelling an action. The okActionBlock is called when the "Ok" button is pressed and the cancelActionBlock is called when the "Cancel" button is pressed.

public func showAlertControllerWithTitle(title:String, message:String, actions:[UIAlertAction])

This shows a UIAlertController with the designated title, message, and actions. This function is ultimately used by the previous two, but there was really no harm in having it as a public function as well.

To Do

  • Write simple convenience methods for ActionSheet style UIAlertControllers.

Installation

GNAlertConveniences is available through CocoaPods. To install it, simply add the following lines to your Podfile:

use_frameworks!
pod "GNAlertConveniences"

Author

Gonzalo Nunez, gonzi@tcpmiami.com

License

GNAlertConveniences is available under the MIT license. See the LICENSE file for more info.

About

A UIViewController extension designed to simplify your life when presenting a UIAlertController.

License:MIT License


Languages

Language:Shell 59.0%Language:Swift 25.3%Language:Ruby 10.4%Language:Objective-C 5.3%