16
My idea is very similar to declare a variable of an interface type in java.
So for example,
header file 1:
@protocol Calculator
@end
I then define an @interface CalculatorImpl which implements the above Calculator protocol.
In header file 2:
@interface SomeViewController : UIViewController {
}
@property (weak, nonatomic) IBOutlet UITextField *txtResult;
@property (weak, nonatomic) Calculator* calculator;
@end
However, the xcode will flag an error at the calculator line
property with 'weak' attribute must be of object type
Is this usage of protocol disallowed by objective-c?