I'm working on App Shortcuts function with AppIntentsExtension which is recommended in WWDC22. But I'm struggled to download or show image after shortcut is executed. Here are main functions:
func perform() async throws -> some IntentResult & ShowsSnippetView & ReturnsValue<URL> {
let requestURL = URL(string: "https://cdn.leonardo.ai/users/3e2e4dd4-8b59-4eac-b8c1-e6a89d88da2c/generations/1db4905a-4593-4f49-9d9f-1179221c0ee3/Leonardo_Signature_A_pretty_animation_girl_3.jpg")!
let result = FileDownloader.loadFileSync(url: requestURL)
// BTW I don't see any log
[Full.txt](https://developer.apple.com/forums/content/attachment/e72637a4-7c4e-4545-b66a-ec0a1bc232ca)
in Xcode Consle
print("Generate image finished")
// Not work with or without PictureView
// Also tried only return result URL, not work either
return .result(value:result, view: PictureView(url: requestURL))
}
struct PictureView: View {
var url: URL
var body: some View {
ZStack{
// Cannot show nothing
AsyncImage(url: url)
// This shows
Image(systemName: "photo.on.rectangle.angled")
.symbolRenderingMode(.monochrome)
.resizable()
.scaledToFit()
.frame(minWidth: 50, minHeight: 50)
}
}
}
Simply saying, I want to just show a image from url or download it so that I can check it out in Photos, using App Intents Extension.