I am updating and squashing bugs on a MacOS app I wrote several years ago. I have a subclass of NSTableView that I defined a delegate for that provides some convenience features for detecting user key and mouse input. The header file looks like this:
I'm getting warnings for...
Warning 1: 'atomic' attribute on property 'delegate' does not match the property inherited from 'NSTableView'
Warning 2: Attribute 'readonly' of property 'delegate' restricts attribute 'readwrite' of property inherited from 'NSTableView'
I cobbled the delegate id property together via Google back when and cannot remember why I coded it as such. I know I can change to readwrite and atomic but I'm just not sure why it worked without warning in the past. What is the proper way to do this?
Code Block @class TKTableView; // delegate protocol @protocol TKTableViewDelegate <NSObject,NSTableViewDelegate> // <NSObject> because we need to use "respondsToSelector" @optional -(void)tableView:(NSTableView *)theTableView enterKeyPressedForRow:(NSInteger)theRow; -(void)tableView:(NSTableView *)theTableView deleteKeyPressedForRow:(NSInteger)theRow; -(void)tableView:(NSTableView *)theTableView didDoubleClickRow:(NSInteger)theRow; -(NSMenu *)tableView:(NSTableView *)theTableView showContextualMenu:(NSEvent *)theEvent; @end @interface TKTableView : NSTableView @property(nonatomic,assign) NSUInteger myRowHighlightStyle; @property(nonatomic,readonly) id<TKTableViewDelegate> delegate; -(void)doubleClickedRow:(id)sender; @end
I'm getting warnings for...
Code Block @property(nonatomic,readonly) id<TKTableViewDelegate> delegate;
Warning 1: 'atomic' attribute on property 'delegate' does not match the property inherited from 'NSTableView'
Warning 2: Attribute 'readonly' of property 'delegate' restricts attribute 'readwrite' of property inherited from 'NSTableView'
I cobbled the delegate id property together via Google back when and cannot remember why I coded it as such. I know I can change to readwrite and atomic but I'm just not sure why it worked without warning in the past. What is the proper way to do this?