I literally have 4 line of code.
var bool = true
let textField1 = UITextField()
let textField2 = UITextField()
bool ? textField1.enabled = false : textField2.enabled = false
The above code fails with following error.
if I write the following way the code works
if bool {
textField1.enabled = false
}
else {
textfield2.enabled = false
}
If I write the following way then short hand of if else works
bool ? print("It's True") : print("It's False")
Why is my code failing?
Aucun commentaire:
Enregistrer un commentaire