I want to use ShareLink to share a URL that is generated from an API call from an async function.
I tried something like this, and it doesn't work:
ShareLink (item: Task {await getSharingURL()} )
{ Image(systemName: "square.and.arrow.up") }
In apple's documentation they say:
Sometimes the content that your app shares isn’t immediately available. You can use FileRepresentation or DataRepresentation when you need an asynchronous operation, like a network request, to retrieve and prepare the content.
https://developer.apple.com/documentation/SwiftUI/ShareLink
But I am not sure how to use it, and would appreciate any example.