I want to check the contents of an NSItemProvider to validate a drop action in SwiftUI on macOS.
I use the code:
let urlProviders = info.itemProviders(for: [.url])
if urlProviders.filter({ $0.canLoadObject(ofClass: NSImage.self) }).some {
return true
}
But I get the compilation error:
Instance method 'canLoadObject(ofClass:)' requires that 'NSImage' conform to '_ObjectiveCBridgeable'
Is this a bug?
The same code works with UIImage
when compiling for iOS.
Xcode 13.4