I am not able to find any way to call the delegate in the below code and without delegate the textFieldDidBeginEditing method cant be called
import UIKit
class ModifiedTextField: UITextField { }
extension UITextField: UITextFieldDelegate{
func fieldEmptyError(value: Bool){
let textFieldVal = "\(self.placeholder!)"
if (value){
layer.borderColor = UIColor.red.cgColor
layer.cornerRadius = 5.0
layer.masksToBounds = true
layer.borderWidth = 1
pulsate()
textFieldOrigVal(string: textFieldVal, borderColor: UIColor.red)
}else {
textFieldOrigVal(string: textFieldVal, borderColor: UIColor.lightGray)
layer.borderWidth = 0.2
layer.borderColor = UIColor.lightGray.cgColor
}
}
public func textFieldDidBeginEditing(_ textField: UITextField) {
textField.fieldEmptyError(value: false)
}
}