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
Implement -respondsToSelector: when using -rac_signalForSelector: on KVO'd target #891
Conversation
@@ -201,9 +235,13 @@ static Class RACSwizzleClass(NSObject *self) { | |||
// Just swizzle -forwardInvocation: in-place. Since the object's class | |||
// was almost certainly dynamically changed, we shouldn't see another of | |||
// these classes in the hierarchy. | |||
// | |||
// Additionally, swizzle -respondsToSelector: becuase the default |
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.
because*
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 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.
😆 😂
Who knew that spelling because wrong could turn out to make my day.
🍰 |
🍨 |
Easy as 1-2-3, A-C-B. |
@@ -87,6 +87,40 @@ static void RACSwizzleForwardInvocation(Class class) { | |||
class_replaceMethod(class, forwardInvocationSEL, imp_implementationWithBlock(newForwardInvocation), "v@:@"); | |||
} | |||
|
|||
static void RACSwizzleRespondsToSelector(Class class) { |
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.
Weird spacing here.
@@ -201,9 +235,13 @@ static Class RACSwizzleClass(NSObject *self) { | |||
// Just swizzle -forwardInvocation: in-place. Since the object's class | |||
// was almost certainly dynamically changed, we shouldn't see another of | |||
// these classes in the hierarchy. | |||
// | |||
// Additionally, swizzle -respondsToSelector: because the default | |||
// implementation is ignorant of methods added to this class. |
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.
*may be ignorant (:trollface:?)
🎩 |
👓 |
😎 |
Implement -respondsToSelector: when using -rac_signalForSelector: on KVO'd target
Fixes #889
When calling
-rac_signalForSelector:
on an object that has been KVO'd, we implement the selector directly on KVO's dynamic subclass. However, the default implementation of-respondsToSelector:
bases its result on the class returned by-class
, which KVO overrides to return the original class, not its custom subclass.This change redefines
-respondsToSelector:
when calling-rac_signalForSelector:
on a target that has been KVO subclassed.