I want to create a custom delegate for NSWindow
.
CustomWindow is subclassed to get notified about NSWindowDelegate
events.
Now I want to create delegate
for this CustomWindow
.
I tried following code:
CustomWindow.h
@class CustomWindow;
@protocol CustomWindowDelegate
- (void)method1:(CustomWindow *)sender userInfo:(NSMutableDictionary*) userInfo;
- (void)method2:(CustomWindow *)sender event:(NSEvent *)theEvent;
- (void)method3:(CustomWindow *)sender;
@end
@interface CustomWindow : NSWindow <NSWindowDelegate>
@property (nonatomic) id <CustomWindowDelegate> delegate;
@end
mainDocument.h
#import "CustomWindow.h"
@interface mainDocument : NSDocument
@property (assign) IBOutlet CustomWindow *mainWindow;
@end
mainDocument.m
#import "mainDocument.h"
@implementation mainDocument
- (void)method1:(CustomWindow *)sender userInfo:(NSMutableDictionary*) userInfo
{
...
...
}
- (void)method2:(CustomWindow *)sender event:(NSEvent *)theEvent
{
...
...
}
- (void)method3:(CustomWindow *)sender
{
...
...
}
@end
Its working as per expectations however its giving following warnings:
'retain (or strong)' attribute on property 'delegate' does not match the property inherited from 'NSWindow'
'atomic' attribute on property 'delegate' does not match the property inherited from 'NSWindow'
Property type 'id' is incompatible with type 'id _Nullable' inherited from 'NSWindow'
Auto property synthesis will not synthesize property 'delegate'; it will be implemented by its superclass, use @dynamic to acknowledge intention
How can I get rid of these warnings ?
Any helps are greatly appreciated.