tonekk
tonekk

Reputation: 478

What does the delegate near @implementation do?

in some code I saw something like this:

 @implementation SomeClass (SomeDelegate)

What does the SomeDelegatedo in that context?

Cheers

Upvotes: 1

Views: 113

Answers (2)

Simon Lee
Simon Lee

Reputation: 22334

It is a category, used to extend the functionality of existing classes. Check out my article on the subject which also contains a collection of really useful categories.

Categories explanation and useful code...find it here.

Upvotes: 1

Rob Napier
Rob Napier

Reputation: 299545

This is a category. Given that it's call "SomeDelegate", I suspect that someone was just breaking up the code in their implementation file to group all the delegate methods together. Some people use multiple @implementation blocks to do that. This is the original use of categories. More often today, categories are used to extend existing classes. See the above link for more information.

Upvotes: 3

Related Questions