I am trying to present an icon on the main view of an Objective-C macOS application. I can choose an image from the list of system images in the xib file but I want to show an icon from the Assets.xcassets AppIcon collection. How can I do this? The icon shows on the main view but with what looks like a default document icon.
From the .h file
@interface Foo : NSObject {
IBOutlet NSTextField *textfield;
IBOutlet NSImageView *iconView;
}
- (IBAction)seed :(id)sender;
- (IBAction)generate:(id)sender;
@end
In the awakeFromNib method I do the following :-
NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:@"ForestMushroom-512"];
[iconView setImage:iconImage]