The below protocol doesn’t have any methods. Is it possible to use it like this? What happens if we declare an empty protocol?
@class CircularPickerView;
@protocol CircularPickerViewDataSource <UIPickerViewDataSource>
@end
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Yes.
Strictly, this is not empty – it is also a
UIPickerViewDataSource. Similar to subclassing, you may passCircularPickerViewDataSourceas aUIPickerViewDataSource. You may also expect it to adoptUIPickerViewDataSource‘s methods, and you will receive warnings if you do not implement the required interface. It may serve as documentation/intent, platform compatibility, or it may be a placeholder for future extension.A protocol that declares no required or optional methods simply specifies adopters need not define any methods in their implementation. Since this is also a
UIPickerViewDataSource, that’s not exactly the case.