This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// Notes: | |
// - You must explicitly weak link to UIKit to support iOS 7 | |
// - Action sheets on iOS 7 only show a title | |
func showAlert(viewController: UIViewController, style: UIAlertControllerStyle = .Alert, title: String? = nil, message: String? = nil, sourceView: UIView? = nil, completion: (() -> ())? = nil, buttons: (UIAlertActionStyle, String, (() -> ())?)...) { | |
if (NSClassFromString("UIAlertController") != nil) { | |
// iOS 8+ |