#UIAlertControllerExtension An extension is written in Swift,
Allow to present a UIAlertController from any ViewController or anywhere.
Support both Alert & ActionSheet style.
- iOS 8.0+ / Mac OS X 10.9+
- Xcode 6.4
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 UIAlertControllerExtension 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 'UIAlertControllerExtension', '~> 1.0'
Then, run the following command:
$ pod install
import UIAlertControllerExtension
UIAlertController.present(title: "Title", message: "Message", actionTitles: ["OK", "Cancel", "Destroy"]) { (action) -> () in
//Handle event callback
println(action.title)
}
import UIAlertControllerExtension
UIAlertController.present(title: "title",
message: "message",
attributedActionTitles: [("OK", .Default), ("Cancel", .Cancel), ("Destroy", .Destructive)])
{ (action) -> () in
//Handle event callback
println(action.title)
}
import UIAlertControllerExtension
UIAlertController.present(style: .ActionSheet, title: "Title", message: "Message", actionTitles: ["OK", "Cancel", "Destroy"]) { (action) -> () in
//Handle event callback
println(action.title)
}
import UIAlertControllerExtension
UIAlertController.present(style: .ActionSheet,
title: "title",
message: "message",
attributedActionTitles: [("OK", .Default), ("Cancel", .Cancel), ("Destroy", .Destructive)])
{ (action) -> () in
//Handle event callback
println(action.title)
}
UIAlertControllerExtension is released under the MIT license. See LICENSE for details.