zrxq/UIView-EasingFunctions — pull request #1 by cmezak (2013-05-03 19:17:41+00:00)
Title: Changed swizzling logic

In the original implementation, the method swizzling on CALayer was happening every time an easing function was set on an instance of that class. I added a static BOOL flag to ensure that this swizzle only happens once. Checking to see if the instance has a dictionary of easing functions won't work, because the swizzle may have taken place from another instance of the class.

Also removed the un-swizzling code from the removeEasingFunction method. We shouldn't be unswizzling unless we know that no other instances of CALayer want to use the swizzled method (we don't).

Is performance the reason that the swizzle is being undone when no longer needed? If it's worth doing, then I'd suggest using a static counter variable to count how many instances of the class are using a custom easing function. The counter would be incremented/decremented in the add/remove methods. Once it reaches 0, we'd know that no other instances are using the a custom easing function and we could unswizzle the method.