I have my ViewController class which implements UITextFieldDelegate. I have no auto complete for the funcs such as textFieldShouldBeginEditing. Is this a bug in XCode 6? Here's my class implementation.
class ViewController: UIViewController, UITextFieldDelegate
class ViewController: UIViewController,UITextFieldDelegate //set delegate to class @IBOutlet var txtValue: UITextField //create a textfile variable override func viewDidLoad() { super.viewDidLoad() txtValue.delegate = self //set delegate to textfile } func textFieldDidBeginEditing(textField: UITextField!) { //delegate method } func textFieldShouldEndEditing(textField: UITextField!) -> Bool { //delegate method return false } func textFieldShouldReturn(textField: UITextField!) -> Bool { //delegate method textField.resignFirstResponder() return true }
Swift 3.0.1 // UITextField Delegates func textFieldDidBeginEditing(_ textField: UITextField) { } func textFieldDidEndEditing(_ textField: UITextField) { } func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { return true; } func textFieldShouldClear(_ textField: UITextField) -> Bool { return true; } func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { return true; } func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { return true; } func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder(); return true; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With