Add rex_valueChanged to UISwitch#115
Closed
dmcrodrigues wants to merge 1 commit intoRACCommunity:masterfrom
Closed
Add rex_valueChanged to UISwitch#115dmcrodrigues wants to merge 1 commit intoRACCommunity:masterfrom
dmcrodrigues wants to merge 1 commit intoRACCommunity:masterfrom
Conversation
fcad0e0 to
3fcf83f
Compare
3fcf83f to
14378f7
Compare
Contributor
Author
|
I'm not happy with this and I think there might be some problems with it so I'll close this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
I've used a few switches in the last days and I found very useful establishing an action to act immediately upon the change of the switch but also controlling the enabled state automatically.
Description
I created this new property highly inspired in the implementation of
rex_pressedand everything worked as expected. However, there's an issue since iOS 7 where a switch can trigger multiple notifications of value changed even when there's not a change of switch's state, rdar://14485185. I changed the implementation a bit to adopt internal observation of changes and trigger the action manually only when there's in fact a change to achieve the originally expected behaviour.I'm not happy with this but the issue is real and undesirable so I decided to contribute it because probably this may be useful to others facing this particular problem.
In case of positive feedback, I'll try to invest some time in a way to test it since apparently we cannot manually trigger
.ValueChangedevents for controls beyondUIButton.