title: Validating Password in Single Text Field Swift
body: <p>This is main story board of my app:</p>
  
  <p><a href="https://i.stack.imgur.com/624Mu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/624Mu.png" alt="enter image description here"></a></p>
  
  <p>I have an iOS app where I have to change the text inside the label from "Set Passcode" to "Confirm Passcode" after entry of 4 digits and then clear the text field. The passcode input is done through clicking the buttons.</p>
  
  <p>Now, I have to give the 4 digits again and compare both the entries using user defaults. I know how to this using two text fields but do not know how to achieve it using single textfield.  </p>