Alert
概览
Alert 是调用 UIAlertController 的简单方式。
用法
通过 SSH:对于那些计划经常直接提交的人,通过 SSH 克隆可能提供更好的体验(需要将 SSH 密钥上传到 GitHub)
$ git clone [email protected]:keisukeYamagishi/Alert.git
通过 https:对于那些仅提取源代码以只读方式的人,HTTPS 表现最好
$ git clone https://github.com/keisukeYamagishi/Alert.git
示例代码
let textField2 = UITextField()
textField2.textColor = .black
textField2.keyboardType = .twitter
textField2.isSecureTextEntry = true
let actions = [AlertAction(textField: UITextField(), placeholder: "Name"),
AlertAction(textField: textField2, placeholder: "Password"),
AlertAction(title: "OK", type: 0, style: .default, handler: { (_, textFields) in
print(textFields?.forEach { print($0.text ?? "Nothing value")} ?? [])
})]
alert(title: "UIAlert", message: "Hi there!\nI'm UIAlert", actions: actions)