-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the rex_textSignal to UITextField #80
Conversation
/// Sends the field's string value whenever it changes. | ||
public var rex_textSignal: SignalProducer<String, NoError> { | ||
return NSNotificationCenter.defaultCenter() | ||
.rac_notifications(UITextFieldTextDidChangeNotification, object: self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't considered this with the NSTextField
version, but doesn't this create a circular reference that leaks the text field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am testing it here, it seems fine, but on the other hand rex_pressed
seems to be leaking:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's more to the retain cycle above than just rex_pressed
since I've already got tests around that. I'm assuming that something with viewModel.authenticate
is causing the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good though, was worried about the notif center retaining the passed in object which it doesn't seem to be.
Added the rex_textSignal to UITextField
Re-tested with only a
And no leaks. 🐥 |
Btw, I re-checked and the leak is coming from here:
If instead of this I just use regular strings, there are no leaks. 👍 |
No description provided.