Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#import <Foundation/Foundation.h>
@interface NSObject (IfClass)
- (id)ifClass:(Class)aClass;
@end
#import "NSObject+IfClass.h"
@implementation NSObject (IfClass)
- (id)ifClass:(Class)aClass {
return [self isKindOfClass:aClass] ? self : nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.