In Objective-C when you declare an instance variable you can check if it conforms to a protocol on assignment at compile time like so:
id <MyProtocol> variable;
Is it possible to check whether an object assigned to the variable conforms to two separate protocols at compile time? As in:
id <MyProtocol, MyOtherProtocol> variable;
I know I can do runtime checking using conformsToProtocol:
and respondsToSelector
et al, (which I do before actually using the object for added safety), and I could write my own setter method that does the check, but I'd like to know at compile time.