Hello all,
I am trying to create a hyperlink
in SwiftUI using ShareLink
. I know that the item you provide to ShareLink
must conform to Transferable
and that AttributedString
conforms to that protocol. However, when I create my attrbuted string I get the hyperlink just fine when sharing via email, but if I share via text message it just shows the words with no hyperlink. I know other apps do this just fine in Text messages, like my 1Password does.
Here is my code:
var tappableLink: AttributedString {
let markDownLink = try! AttributedString(markdown: "[Download \(card.appData.trackName ?? "Unknown App Name")](\(card.appData.trackViewURL!))")
return markDownLink
}
Heres where I use it with ShareLink
ShareLink(
item: tappableLink,
subject: Text(LocalizedAppConstants.shareAppLinkSubject),
message: Text(LocalizedAppConstants.shareingAppLinkBody),
preview: SharePreview(
card.appData.trackName!,
image: SFImage.shareApp.image
),
label: {
Label("Share App Link", systemImage: "square.and.arrow.up")
}
)
Can anyone help me with getting a hyperlink
that says Download <INSERT APP NAME>
so that in text or email it works the same. I cannot seem to find out why the above is not working in text message.
Thanks,
Taz