Reputation: 8546
I have created a UITableView
subclass SliderTableView
and created a NSObject
subclass SliderDataSource
that act as the UITableViewDataSource delegate
.
I want to extend the UITableViewDataSource protocol
. Should I declare the extended protocol in SliderTableView
or in the SliderDataSource
. If I declare the protocol in SliderTableView
I will need to import it in my delegate, If I declare it in the delegate I won't need to import it but it sounds fishy to declare the protocol you obey to.
Upvotes: 0
Views: 36
Reputation: 16660
If your question is, in which header file it should be defined, you should define it in SliderTableView.h. SliderTableView
determine the content of the protocol, knows what it needs and so on. So it is the right place. The import is correct, because there is a dependency.
Anyway you can define the protocol in an extra header file for that protocol, too.
Upvotes: 1