samedi 30 avril 2016

How can i use if statement UItextfield in Swift

My code like this

@IBOutlet var variable: UITextField!
var variable2 : String = "magpie";
@IBAction fun c login(sender: AnyObject) {
    if (variable == variable2 ) {

    self.performSegueWithIdentifier("login", sender: self)
        }

I want to do like this but it does not work what can i do ? if i use

if (variable.text! == "a") 

its working but i dont want to do this. i want to use variable thank you all

Aucun commentaire:

Enregistrer un commentaire