Created
March 1, 2014 02:35
-
-
Save anonymous/9284141 to your computer and use it in GitHub Desktop.
Halps
This file contains 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
//Instead of passing in the sender, can I use the Objective-C runtime to figure out the method caller? | |
+ (instancetype)callsomeMethodWithSender:(id)sender | |
{ | |
//Prevent this method from being called from outside of this class | |
if ([self class] == [MyClass class] || [[sender class] isSubclassOfClass:[MyClass class]]) | |
{ | |
//doSomething | |
} | |
else | |
{ | |
NSAssert(NO, @"You cannot call this method from outside of this class."); | |
return nil; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment