My app should donate a shortcut to the shortcuts app, to retrieve a random image. However I am unable to return an image, and do understand how it should be done.
My intents file is as following. As "image" aint a possible return type, I instead return a file.
My code:
class TestIntentHandler: NSObject, TestIntentIntentHandling {
func handle(intent: TestIntentIntent, completion: @escaping (TestIntentIntentResponse) -> Void) {
let response = TestIntentIntentResponse(code: .success, userActivity: nil)
let data = UIImage(named: "test")!.pngData()!
response.image = INFile(data: data, filename: "tester", typeIdentifier: "png")
completion(response)
}
func confirm(intent: TestIntentIntent, completion: @escaping (TestIntentIntentResponse) -> Void) {
completion(TestIntentIntentResponse(code: .ready, userActivity: nil))
}
}
But testing the shortcut dont show the image.