Setting NSMenuItem checkMark as diamond

As described in HIG, I want to set the checkmark of a menutitem to diamond shape.


I cannot find in the documentation how to do it.


I have tried the following:


create a png image Diamond (with a capture of image of diamond char) and include in xcassets


individuMenuItem.onStateImage = NSImage(named: "Diamond")


I effectively get a diamond, but it is overlapping menu text. And that seems an awkward solution to create a png ; I would prefer to call directly the correct char (155 ?)


I read some way on how to do this in objC, but cannot get it working as I do not find _NSGetThemeImage in Swift


NSImage* _NSGetThemeImage(int num); 
[menuitem setState:NSOnState]; 
[menuitem setOnStateImage:_NSGetThemeImage(155)];

I continue to search.


Found this code, which seems to mean that _NSGetThemeImage may have been deprecated


#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
     if (floor (NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5)
       {
  if (_NSGetThemeImage != NULL)
   image = _NSGetThemeImage (0x9b);
  else
   image = nil;
       }
     else
#endif
       image = [NSImage imageNamed:@"NSMenuItemDiamond"];


But I do not find either NSMenuItemDiamond


Source : https : / / searchcode.com/codesearch/view/27232414/

Found this discussion dating back 2004 on the topic.


Seems that SetItemMark was an unsupported function for NSMenuItem.


Is that still the case ?


If yes, how to apply HIG that stipulates one should adapt the mark to "what it means" ?

Setting NSMenuItem checkMark as diamond
 
 
Q