I have 3 classes A, B and C.
B is a subclass of A.
A has a property named theView.
I create an object based on B (objectB).
Inside objectB I created an objectC based on class C, where
objectC.delegate = (id)objectB;
objectB.delegate = (id)objectA;
how do I access objectB’s theView property from inside objectC without having to import objectB’s header? I would like to use just the delegate properties to do that.
If I try from C, for example:
CGRect bounds = [delegate.theView bounds];
I receive the error:
property theView not found on object of type id<classBdelegate> ???!!!
You could use key/value calls. They aren’t type-checked at compile time, but will do the job without warnings. And if you get the wrong type of delegate at runtime the call will return null if it doesn’t include the specified property (aka. key).
All that said, the compile-time checking of SVD’s answer would be better IMO.