when writing interface and implementation files, is there a middle found between choosing one class of objects to use as arguments or to be returned and using id? That is, can I choose a collection of classes that could be used instead of just one specific one or any object type (id)?
when writing interface and implementation files, is there a middle found between choosing one
Share
You could specify that the Objective-C type must conform to a protocol.
NSObjectis both a class and a protocol. So, one idea would be to specifyid<NSObject>.Or, alternatively, have your protocol extend the
NSObjectprotocol. You’ll need that if you want use of methods such asrespondsToSelector.