Oren Edrich Oren Edrich - 3 months ago 23
Swift Question

Simple password with uitextfeild in swift

I am trying to make a login page that will allow someone to type in a simple 6 digit numerical passcode. The log in page will come already set with the password of "719403" and the user can't change it. If the passcode is correct it will segue to a different viewcontroller, but if the password is wrong then nothing will happen. I have been looking everywhere on how to do this but i can't find anything. If anyone knows how to do this please comment.


Create an @IBOutlet of your UITextField and set your viewController to be a delegate of your text field in viewDidLoad.

self.textField.delegate = self

Then when you want to initiate the segue, check to see if your textField value equals "719403":

if self.textField.text == "719403" {
//perform segue