Cocoa - get the right sized NSImage from Assets.xcassets

Hello
What is the right way to get the AppIcon image representation of the desired size?
Say, I have filled out the AppIcon with all images from 16x16 up to 1024x1024. Whenever I do NSImage(named: "AppIcon") I get the largest possible image (judging by the image.size).
Is there a way to get a, for example, 32x32 image? Or do I have to draw the image manually as shown here https://stackoverflow.com/questions/11949250/how-to-resize-nsimage/17396521 ?
Thanks

Replies

The NSImage object contains multiple representations. For the most part, you don't need to care about them, the most appropriate will be selected. If you really want to chose one of them, then you can use https://developer.apple.com/documentation/appkit/nsimage/1519961-bestrepresentation with an appropriate size rect.