Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krimpedance/KRAlertController
A colored alert view for your iOS.
https://github.com/krimpedance/KRAlertController
Last synced: about 2 months ago
JSON representation
A colored alert view for your iOS.
- Host: GitHub
- URL: https://github.com/krimpedance/KRAlertController
- Owner: krimpedance
- License: mit
- Archived: true
- Created: 2016-02-29T16:53:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-09T10:08:11.000Z (about 6 years ago)
- Last Synced: 2024-11-16T03:04:51.495Z (2 months ago)
- Language: Swift
- Size: 158 KB
- Stars: 52
- Watchers: 7
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - KRAlertController - A colored alert view for your iOS. (UI / Alert & Action Sheet)
- awesome-swift - KRAlertController - A beautiful alert controller for your iOS. (Libs / UI)
- awesome-ios-star - KRAlertController - A colored alert view for your iOS. (UI / Alert & Action Sheet)
- awesome-swift - KRAlertController - A colored alert view for your iOS. ` 📝 3 years ago` (UI [🔝](#readme))
README
[日本語](./README_Ja.md)
# KRAlertController
[![Version](https://img.shields.io/cocoapods/v/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController)
[![License](https://img.shields.io/cocoapods/l/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController)
[![Platform](https://img.shields.io/cocoapods/p/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController)
[![Download](https://img.shields.io/cocoapods/dt/KRAlertController.svg?style=flat)](http://cocoapods.org/pods/KRAlertController)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CI Status](http://img.shields.io/travis/krimpedance/KRAlertController.svg?style=flat)](https://travis-ci.org/krimpedance/KRAlertController)`KRAlertController` is a beautiful and easy-to-use alert controller for your iOS written by Swift.
## Requirements
- iOS 10.0+
- Xcode 10.0+
- Swift 4.2+## DEMO
To run the example project, clone the repo, and open `KRAlertControllerDemo.xcodeproj` from the DEMO directory.or [appetize.io](https://appetize.io/app/jc2066a1jncndy2uet7wkp0ykg)
## Installation
KRAlertController is available through [CocoaPods](http://cocoapods.org) and [Carthage](https://github.com/Carthage/Carthage).
To install it, simply add the following line to your Podfile or Cartfile:```ruby
# Podfile
pod "KRAlertController"
``````ruby
# Cartfile
github "Krimpedance/KRAlertController"
```## Usage
(see sample Xcode project in /Demo)**Mainly the same as UIAlertController.**
At first, import `KRAlertController` in your swift file.
Show simple alert.
```Swift
KRAlertController(title: "Title", message: "message")
.addCancel()
.addAction("OK") { action, textFields in
print("OK")
}
.show()
```### Initializer
```Swift
init(title: String?, message: String?, style: KRAlertControllerStyle = .Alert)
```### Alert types
There is 7 kinds of alert.
`icon` pass true to display glaph icon; otherwise, pass false.
Default view controller to display alert is visible view controller of key window.
```Swift
func show(presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showSuccess(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showInformation(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showWarning(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showError(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showEdit(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showAuthorize(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
``````Swift
// Example
alert.showSuccess(true)
alert.showWarning(true, presentingVC: self, animated: false) {
print("Showed warning alert!")
}
```## Contributing to this project
I'm seeking bug reports and feature requests.## Release Note
+ 3.1.0
- Compatible with Swift 4.2.+ 3.0.1
- Compatible with Swift 4.1.+ 3.0.0
- Supported Xcode9 and Swift4.## License
KRAlertController is available under the MIT license. See the LICENSE file for more info.