I have an existing class for which I do not have the source, and I want to
add a property to the class. The private class implements a known protocol
which is exposed, but the class type is not exposed
.
Some callback happens and I receive the object named answer
.
I want to extend the ComplexNumber type to have more properties, e.g.
@interface NSObject()<ComplexNumber>
@property (assign) BOOL offline;
@end
@implementation SomeClass
didReceiveAnswer:id<ComplexNumber>answer forEquation:(NSString*)equation {
//
if (answer.offline) {
//
}
}
@end
This also fails:
Cast unknown type
to be of type NSObject
:
if (((NSObject*)answer).offline) {
//
}