in Diffusion-macOS/DiffusionImage+macOS.swift [70:83]
func loadData(withTypeIdentifier typeIdentifier: String, forItemProviderCompletionHandler completionHandler: @escaping @Sendable (Data?, Error?) -> Void) -> Progress? {
if typeIdentifier == NSPasteboard.PasteboardType.fileURL.rawValue {
let data = fileURL.dataRepresentation
completionHandler(data, nil)
} else if typeIdentifier == UTType.png.identifier {
let data = pngRepresentation()
completionHandler(data, nil)
} else {
// Indicate that the specified typeIdentifier is not supported
let error = NSError(domain: "com.huggingface.diffusion", code: 0, userInfo: [NSLocalizedDescriptionKey: "Unsupported typeIdentifier"])
completionHandler(nil, error)
}
return nil
}