Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7932317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:58:52+00:00 2026-06-03T20:58:52+00:00

I can find plenty of questions about making objects support multiple protocols but none

  • 0

I can find plenty of questions about making objects support multiple protocols but none confirming whether a @property can. For example I have a class with a property of:

@property (strong) id dataSource;

The object passed in here supports the UITableViewDataSource protocol so I can assign it thus without problems, in ARC with no warnings:

self.tableView.dataSource = self.dataSource;

I’d like to also implement another protocol for say, searching, named CustomControllerSearchDelegate. However if I start invoking random other methods ARC unsurprisingly starts complaining. So we go down the protocol road defining it in in my object and making the property support it. This then causes problems with assigning to the table data source. So to the main question, can I do this:

@property (strong) id <UITableViewDataSource, CustomControllerSearchDelegate> dataSource;

and if not what is an appropriate alternative?

Or, what is the correct way to cast something to remove this compiler warning:

Assigning to 'id<UITableViewDataSource>' from incompatible type
'id<PickerViewControllerDataSource>'

Apologies if this is poorly explained. :/

— Edit —

So my protocol is now defined as:

@protocol PickerViewControllerDataSource <UITableViewDataSource>

With the property defined as:

@property (strong) id <PickerViewControllerDataSource> dataSource;

Yet the compiler throws the following error:

No known instance method for selector 'objectAtIndexPath:'

— Edit —

Declared above in custom protocol. Declaration now reads:

@protocol PickerViewControllerDataSource <UITableViewDataSource>

- (id)objectAtIndexPath:(NSIndexPath *)indexPath;

@optional

- (void)searchDataWithString:(NSString*)string;
- (void)cancelSearch;

@end

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:58:53+00:00Added an answer on June 3, 2026 at 8:58 pm

    You can create a protocol that incorporates other protocols, for example:

    @protocol MyDataSourceProtocol <UITableViewDataSource, CustomControllerSearchDelegate>
    @end
    

    From the Objective-C Programming Guide:

    One protocol can incorporate other protocols using the same syntax
    that classes use to adopt a protocol:

    @protocol ProtocolName < protocol list >

    Your dataSource property would then be defined as:

    @property (strong) id <MyDataSourceProtocol> dataSource;
    

    Alternatively your CustomControllerSearchDelegate protocol can incorporate the UITableViewDataSource protocol:

    @protocol CustomControllerSearchDelegate <UITableViewDataSource>
      ... new methods here ...
    @end
    

    In this case, your dataSource property would then be defined as:

    @property (strong) id <CustomControllerSearchDelegate> dataSource;
    

    I personally prefer the latter approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can find tutorials about mapping textures to polygons specifying vertices etc. but nothing
Looks like there's a plenty of questions about centering, same size etc, but so
I can find plenty of info on how msi upgrades. E.g. info about minor
There are plenty of questions of how to use CheckedTextView but I can't make
I can find plenty of documentation on swapping out views in a window, but
Where can find resources about best practices for SharePoint programming? I am talking about
I can find the definition files at http://www.php.net/~helly/php/ext/spl/... but I want to extend DirectoryIterator
I know there are plenty of questions here already about this topic (I've read
I know there are plenty of questions regarding this error, but I haven't found
I know there is plenty of question answered over here https://stackoverflow.com/questions/tagged/youtube+regex , but not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.