From 8a17002e7ebb9b4eae49d02bf0f8f70f3f12537d Mon Sep 17 00:00:00 2001 From: Ben Cochran Date: Mon, 2 May 2016 17:05:12 -0700 Subject: [PATCH] Make `UITextField.rex_text` send on all editing events This solves some issues around keyboard shortcuts and autocomplete. See also: https://github.com/ReactiveCocoa/ReactiveCocoa/pull/1767 --- Source/UIKit/UITextField.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/UIKit/UITextField.swift b/Source/UIKit/UITextField.swift index f73c4f4..68f2830 100644 --- a/Source/UIKit/UITextField.swift +++ b/Source/UIKit/UITextField.swift @@ -14,8 +14,7 @@ extension UITextField { /// Sends the field's string value whenever it changes. public var rex_text: SignalProducer { - return NSNotificationCenter.defaultCenter() - .rac_notifications(UITextFieldTextDidChangeNotification, object: self) - .filterMap { ($0.object as? UITextField)?.text } + return rex_controlEvents(.AllEditingEvents) + .filterMap { ($0 as? UITextField)?.text } } }