swift - Swift 验证函数
问题描述
你好我正在尝试创建一个名为 validate 的函数,我可以使用我创建的函数,但是当我想将它添加到屏幕时遇到问题。如何在不创建我在主页上的函数中创建的警报变量的情况下摆脱错误?
func validation(title:String,message:String,uiAlertActionTitle:String){
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.actionSheet)
alert.addAction( UIAlertAction(title: uiAlertActionTitle, style: UIAlertAction.Style.default, handler: nil))
}
主要场所
validation(title: "Error", message: "Mail or Password is Wrong", uiAlertActionTitle: "OK")
self.present(alert, animated: true, completion: nil)
解决方案
推荐阅读
- docker - Flink 在 Openshift 4.4.9 上没有上去比如 Running-state
- sql-server - XML 和 SQL Server 中的 int 是什么?
- mysql - 试图从 MySql 结果字符串中删除“/”
- python - 从 memoryview 在 Cython 中创建唯一数组
- r - 根据多列的方差计算权重并计算加权和
- flutter - 适用于 iOS 和 Android 设备的 Flutter Cast
- batch-file - 如何“测试”一个变量是否大于 DOS 中的另一个变量?
- apache-superset - 如何通过超集中的 JSON 元数据设置默认过滤器值
- microsoft-graph-api - 在 Azure AD 中注册应用程序
- python - 在另一个文件中使用一个文件的变量