sarahbleicher / EZAlertController

Easy Swift UIAlertController

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EZAlertController

Cocoapods Compatible Bitdeli Badge

Easy Swift UIAlertController

  • One line setup for all UIAlertControllers
  • Button action with closures instead of selectors
  • Easily customizable

Usage

One Button Alert

EZAlertController.alert("Title")
EZAlertController.alert("Title", message: "Message")
EZAlertController.alert("Title", message: "Message", acceptMessage: "OK") { () -> () in
    print("cliked OK")
}

EZAlertController

Two Button Alerts

EZAlertController.alert("Title", message: "Message", cancelBlock: 
  { () -> () in
    print("clicked cancel")
    }) { () -> () in
     print("clicked accept")
}

EZAlertController.alert("Title", message: "Message", leftButtonMessage: "Cancel", rightButtonMessage: "Accept", leftBlock: 
  { () -> () in
    print("clicked cancel")
    }) { () -> () in
      print("clicked accept")
}

EZAlertController

Customizable

let alertController = EZAlertController.alert("My Title") // Returns UIAlertController
alertController.buttonCornerRadius = 20.0f;
alertController.view.tintColor = self.view.tintColor;
alertController.titleFont = UIFont(name: "AvenirNext-Bold", size: 19.0)
alertController.backgroundTapDismissalGestureEnabled = true
...

###Requirements

  • Swift version 2.0

Installation

Install via CocoaPods

You can use Cocoapods to install EZAlertController by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!

pod 'EZAlertController'

Install Manually

  • Download and drop 'EZAlertController.swift' in your project.

##Improvement

  • Feel free sending pull requests.

##License

  • EZAlertController is available under the MIT license. See the LICENSE file.

##Keywords swift, alert, AlertView, AlertViewController, UIAlertView, UIAlertViewController

About

Easy Swift UIAlertController

License:MIT License


Languages

Language:Swift 81.4%Language:Ruby 18.6%