Hi,
Just wanted to share with my code for UITextField.
With this you are able to see when textField begin and end editing. Peace
class RxTextFieldDelegateProxy: DelegateProxy, UITextFieldDelegate, DelegateProxyType {
class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
let locationManager: UITextField = object as! UITextField
locationManager.delegate = delegate as? UITextFieldDelegate
}
class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
let locationManager: UITextField = object as! UITextField
return locationManager.delegate
}
}
extension Reactive where Base: UITextField {
var delegate: DelegateProxy {
return RxTextFieldDelegateProxy.proxyForObject(base)
}
var didBeginEditing: ControlEvent<()> {
return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldDidBeginEditing(_:)))
.map { a in
return ()
})
}
var didEndEditing: ControlEvent<()> {
return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextFieldDelegate.textFieldDidEndEditing(_:)))
.map { a in
return ()
})
}
}
Hi @adamsmaka ,
I think you can use
textField.controlEvent(.editingDidBegin)
textField.controlEvent(.editingDidEnd)
Most helpful comment
Hi @adamsmaka ,
I think you can use