Skip to content
/ Alert Public

Alert is a syntax sugar library of UIAlertController

License

Notifications You must be signed in to change notification settings

tattn/Alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alert

Carthage compatible Platform License Swift Version

Alert is a syntax sugar library of UIAlertController.

Usage

Simple

import Alert

Alert(title: "Title", message: "Message")
    .addAction("OK") { _ in
        print("ok")
    }
    .addAction("Cancel", style: .cancel) { _ in
        print("cancel")
    }
    .present()

ActionSheet(title: "Title", message: "Message")
    .addAction("OK") { _ in
        print("ok")
    }
    .addAction("Cancel", style: .cancel) { _ in
        print("cancel")
    }
    .presentingSource(view)
    .present()

TextField

Alert(title: "Title", message: "Message")
    .addAction("OK") { _ in
        print("ok")
    }
    .addAction("Cancel", style: .cancel) { _ in
        print("cancel")
    }
    .addTextField(configuration: { textField in
        textField.placeholder = "E-mail"
    }, textDidChanged: { alert, textField in
        print(textField.text)
    })
    .addTextField(configuration: { textField in
        textField.placeholder = "Password"
        textField.isSecureTextEntry = true
    })
    .present()

Installation

Carthage

github "tattn/Alert"

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

Alert is released under the MIT license. See LICENSE for details.