I have an app which sets the texture of a SKSprite with an image chosen by the user via a NSOpenPanel. Once a file's chosen, I call:
let newTexture = SKTexture(image: NSImage(byReferencing: imageURL))
textureSpriteNode.run(SKAction.setTexture(newTexture))
The problem is that if a user chooses a .raf file (FujiFilm RAW), the NSImage(byReferencing:_) returns a blank image instead of throwing an error.
I've tried filtering the images that can be selected by the user in an NSOpenPanel by using
openPanel.allowedFileTypes = NSImage.imageTypes
But the list includes FujiFilm RAW so the panel allows the user to select one. Trying to open the same file in OSX's Preview will cause an alert to appear that this type of image isn't supported.
Is there a way of getting a true list of the supported image types from OSX?