我们有办法在 Swift 中做到这一点吗?
var myTextfield: UITextfield
if textfield is myTextField {
condition
}
我尝试过但失败了:
if UITextfield = myTextField
if textfield = myTextField
if UITextfield.type = myTextField
还尝试过“==”作为比较运算符。
最佳答案
Swift also provides two identity operators (=== and !==), which you use to test whether two object references both refer to the same object instance.
关于ios - 如果文本字段是 myTextField { 条件 },我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32973014/