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
#import <Foundation/Foundation.h> | |
@protocol ProtocolOne <NSObject> | |
@optional | |
- (void)one; | |
@end | |
@protocol ProtocolTwo <NSObject> | |
@optional | |
- (void)two; |
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
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
#import <objc/message.h> | |
@interface A : NSObject - (void)abc; @end | |
@interface B : A @end | |
@interface C : B @end | |
@implementation A - (void)abc { NSLog(@"-[A abc]"); } @end | |
@implementation B - (void)abc { NSLog(@"-[B abc]"); } @end | |
@implementation C - (void)abc { NSLog(@"-[C abc]"); } | |
-(void)abc_A { struct objc_super sup = {self, [A class]}; objc_msgSendSuper(&sup, @selector(abc)); } |
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
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
@interface NSInvocation (PrivateAPI) -(void)invokeUsingIMP:(IMP)imp; @end | |
@interface A : NSObject - (void)abc; @end | |
@interface B : A @end | |
@interface C : B @end | |
@interface X : NSObject - (void)xyz; @end | |
@implementation A - (void)abc { NSLog(@"-[A abc]"); } @end | |
@implementation B @end |
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
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
@interface A : NSObject - (void)abc; @end | |
@interface B : A @end | |
@interface C : B @end | |
@implementation A - (void)abc { NSLog(@"-[A abc]"); } @end | |
@implementation B @end | |
@implementation C - (void)abc { [super abc]; NSLog(@"-[C abc]"); } @end | |
@interface X : NSObject - (void)xyz; @end |
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
// Since ModelManager is usually a simple facade for many other smaller managers, it can dispatch most method calls to its subcomponents based on which protocol includes the selector. | |
BOOL ProtocolIncludesSelector (Protocol *protocol, SEL selector) | |
{ | |
struct objc_method_description methodDescription = protocol_getMethodDescription(protocol, selector, YES, YES); | |
return NULL != methodDescription.name; | |
} | |