I\'m trying to show changes made to a UITextField on a separate UILabel. Is there a way to capture full text of the UITextField after
In Swift 2.0+
class CheckInViewController: UIViewController, UITextFieldDelegate {
override func viewDidLoad() {
super.viewDidLoad()
yourTextField.delegate = self
}
func textField(textField: UITextField!, shouldChangeCharactersInRange range: NSRange, replacementString string: String!) -> Bool {
var updatedTextString : NSString = textField.text as NSString
updatedTextString = updatedTextString.stringByReplacingCharactersInRange(range, withString: string)
self.methodYouWantToCallWithUpdatedString(updatedTextString)
return true
}
}
Hope it helps you swift pioneers