iluuu1994/ITSwitch — pull request #10 by nscoding (2014-05-15 09:38:22+00:00)
Title: Removing extra willChangeValueForKey and didChangeValueForKey methods

Hey thanks for sharing the switch control! I have the following suggestion:

In properties where you don't have a custom setter name like target, action and tint colour you shouldn't invoke willChangeValueForKey: and didChangeValueForKey: , since KVO runtime magic will do it as well. This results on getting twice the change notification.

For setEnabled: and setOn: is correctly done because KVO can't figure out where to add the will/did change calls.

Alternatively, you could opt out with automaticallyNotifiesObserversForKey:

Correct me if I am wrong.