Question

For instance, we have two categories:

@interface NSString (Utilities)
- (void)someMethod;
@end

@interface NSString (RBTree)
- (void)someOtherMethod;
@end

And we need something like this:

if (category that contains someMethod is Utilities){
   // ... anything here ...
}

Just curious.

Was it helpful?

Solution

How curious are you?

Let's start you on a journey:

The Objective C Runtime Reference defines a type Category for categories, but does not itself provide any functions which take or return values of this type. This suggests that some sort of category structure does exist, at least at some point, but the functions that operate on it are not made public.

But why make the type public, if not to reference it somewhere else...?

Dynamic module loading (Dynamic Loading, objc-load.h) provides three functions which take a callback function which is passed an argument of type Category; so more evidence that some structure describing categories exists, at least during loading.

Your next stop might be Apple's open source repository...

Have fun!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top