3 ms·
KVO creates a new subclass and changes your object to that subclass rather than replacing methods on the original class, so checking the isa pointer would be su
by plorkyeran 9y ago
KVO creates a new subclass and changes your object to that subclass rather than replacing methods on the original class, so checking the isa pointer would be sufficient for that case. Method swizzling would break, but I suspect that most obj-c code could be compiled without support for swizzling without breaking anything.
- icodestuff 9y agoSwizzling is not the only thing that would break. You'd break categories in dynamically loaded frameworks or bundles, and yes, you'd still break KVO because it replaces -dealloc and -class on the newly-created classes. You'd also break dynamically adding methods to classes.
- CodeWriter23 9y agoWhat is a typical use case for dynamically adding methods to a class?