Reputation: 25748
I am wondering in Xcode, can I quickly know which classes implement some protocols?
I don't want to use search, but want to quickly identify such classes.
Upvotes: 17
Views: 3996
Reputation: 202
in particular class in which protocol implement just press 'command btn + right click of mouse' on protocol method..
it will show list of all class with implementation of this method. and you can jump on that class by just click on it...
Upvotes: 10
Reputation: 7720
You can use the Assistant Editor:
@protocol
definitionProtocols
:The classes that implement the protocol will be in the list.
Edited to add info from Rob's comment:
Note that this only finds classes that, either in their public header or in their implementation declare that they conform to the protocol. If conformance to the protocol is declared somewhere else, those classes will not show up.
Say you have a protocol defined somewhere as
@protocol MyProtocol <NSObject>
…
@end
A class with a public header MyClass.h
like this will show up:
@interface MyClass : NSObject <MyProtocol>
Also, a class that is extended in the .m file like this will show up
@interface MyObject () <SomeProtocol>
…
@end
@implementation MyObject
…
@end
A class extension MyClass_Extension.h
like this will not show up:
@interface MyObject (Extension) <SomeProtocol>
…
@end
Upvotes: 8