ZWAlertController 0.3.0

ZWAlertController 0.3.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2019
SPMSupports SPM

Maintained by Initial-C.



  • By
  • Initial-C-William Chang

ZWAlertController

Build Version Language Platform License Jianshu

Made by InitialC

Module Address Version Date Author
ZWAlert&ZWAlertController  https://github.com/Initial-C/ZWAlertController.git 0.3.0 2019.04.18 Initial-C

⚠️ To use with Swift 3.x please ensure you are using == 0.0.8.6 ⚠️

⚠️ **To use with Swift 4.x please use above 0.2.0 version ** ⚠️

⚠️ **To use with Swift 5.x please use above 0.3.0 version ** ⚠️

Swift 3.x请使用0.0.8.6

Swift 4.0请使用0.2.0以上版本

Swift 5.0请使用0.3.0以上版本

Example

0.0.3 version were updated something about limit characters, it can limit the input of Chinese and English Emoji more precisely

0.0.3 版本已支持ZWAlertController弹出文本输入框下的中英文emoji混输 以及完美支持emoji字符数限制

0.1.2 版本新增方块样式, 可以在初始化时使用.customActionSheet0.1.2 version of the new custom style, you can use.CustomActionSheet at initialization

0.2.0 版本新增简约卡片弹窗样式, 可以在初始化时使用.simplify和CustomCardSheet样式0.2.0 version of the new simplify style, you can use.simplify at initialization

0.3.0 优化并增加支持Swift5.00.3.0 Upgrade to Swift 5

  To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

ZWAlertController

Simple Alert View written in Swift, which can be used as a UIAlertController replacement.
It supports from iOS7! It is simple and easily customizable!

NewCustomForSheetStyle AlertStyle SheetStyle ZWAlert

Easy to use

ZWAlertController can be used as a UIAlertController.

// Set title, message and alert style
let alertController = ZWAlertController(title: "title", message: "message", preferredStyle: .Alert)
// Create the action.
let cancelAction = ZWAlertAction(title: "Cancel", style: .Cancel, handler: nil)
// You can add plural action.
let okAction = ZWAlertAction(title: "OK" style: .Default) { action in
NSLog("OK action occured.")
}
// Add the action.
alertController.addAction(cancelAction)
alertController.addAction(okAction)
// Show alert
presentViewController(alertController, animated: true, completion: nil)

Customize

  • add TextField (Alert style only)
  • change Fonts
  • change color (Overlay, View, Text, Buttons)

Custom Limit-Entry-Range

Add TextField

alertController.addTextFieldWithConfigurationHandler { textField in
    // text field(UITextField) setting
    // ex) textField.placeholder = "Password"
    //     textField.secureTextEntry = true
}
alertController.textLimit = 20  // you can limit str length for Chinese or English character, base for English character range

Change Design

Overlay color
alertController.overlayColor = UIColor(red:235/255, green:245/255, blue:255/255, alpha:0.7)
Background color
alertController.alertViewBgColor = UIColor(red:44/255, green:62/255, blue:80/255, alpha:1)
Title (font, text color)
alertController.titleFont = UIFont(name: "GillSans-Bold", size: 18.0)
alertController.titleTextColor = UIColor(red:241/255, green:196/255, blue:15/255, alpha:1)
Message (font, text color)
alertController.messageFont = UIFont(name: "GillSans-Italic", size: 15.0)
alertController.messageTextColor = UIColor.whiteColor()
Button (font, text color, background color(default/highlighted))
alertController.buttonFont[.Default] = UIFont(name: "GillSans-Bold", size: 16.0)
alertController.buttonTextColor[.Default] = UIColor(red:44/255, green:62/255, blue:80/255, alpha:1)
alertController.buttonBgColor[.Default] = UIColor(red: 46/255, green:204/255, blue:113/255, alpha:1)
alertController.buttonBgColorHighlighted[.Default] = UIColor(red:64/255, green:212/255, blue:126/255, alpha:1)
// Default style : [.Default]
// Cancel style : [.Default] → [.Cancel]
// Destructive style : [.Default] → [.Destructive]

Installation

ZWAlertController is available through CocoaPods.

To install add the following line to your Podfile:

pod 'ZWAlertController'

License

This software is released under the MIT License, see LICENSE.txt.

Author

Initial-C-William Chang, [email protected]

License

ZWAlertController is available under the MIT license. See the LICENSE file for more info.