当前位置:网站首页>How to check if a text field is empty or not in swift

How to check if a text field is empty or not in swift

2022-06-26 13:54:00 javail

problem :

I am working on the code below to check the textField1 and textField2 text fields whether there is any input in them or not. I am writing the following code to check textField1 and textField2 Whether the text field has any input .

The IF statement is not doing anything when I press the button. When I press the button , IF Statement does nothing .

 @IBOutlet var textField1 : UITextField = UITextField() @IBOutlet var textField2 : UITextField = UITextField() @IBAction func Button(sender : AnyObject)   {    if textField1 == "" || textField2 == ""       {  //then do something      }    }

Solution :

Reference resources : https://stackoom.com/en/question/1d8CH
原网站

版权声明
本文为[javail]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202170512177837.html