I have this in my .pch file:
#import "UIViewController+Loader.h"
The implementation for the category looks like this:
static char kUIViewControllerBaseViewKey;
@implementation UIViewController (Loader)
- (void)setLoader:(LoaderView *)loaderView {
objc_setAssociatedObject(self, &kUIViewControllerBaseViewKey, loaderView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (LoaderView *)loader {
LoaderView *loaderView = (LoaderView *)objc_getAssociatedObject(self, &kUIViewControllerBaseViewKey);
if (!loaderView) {
loaderView = [[LoaderView alloc] initWithView:self.view];
[self.view addSubview:loaderView];
[self setLoader:loaderView];
}
return loaderView;
}
@end
The problem is that in any view controller when I do this:
[self.loaderView doSomething];
Xcode shows this error: Property 'loaderView' not found on object of type MyViewController
HOWEVER, the project compiles fine and the doSomething: method on loaderView works fine. How can I get Xcode to stop showing these errors?