SwiftUI: Missing actions from share sheet when using ShareLink with SharePreview

750 views Asked by At

I am currently having issues with the implementation of a SwiftUI share sheet for an iOS16 application that I want to develop. I Implemented the share sheet using ShareLink that I want to customize with a SharePreview. The item I want to share is a simple link.

I implemented the share sheet exactly like described in Apple's documentation:

ShareLink(
    item: URL(string: "https://developer.apple.com/xcode/swiftui/")!,
        preview: SharePreview(
            "SwiftUI",
            image: Image("SwiftUI")
        )
)

This, results in a weird share sheet that only has one action for creating a "New Quick Note".

enter image description here

What I want to achieve, however, is a "normal" share sheet with all available share options. But I was only able to make this happen by deleting the custom SharePreview, as shown below.

ShareLink(
    item: URL(string: "https://developer.apple.com/xcode/swiftui/")!
)

enter image description here

So: Is this the bug or am I doing something wrong here? Any help is much appreciated :)

1

There are 1 answers

0
James Grote On

I'm pretty sure this is a bug. I get the same issue when sharing a simple String and providing a preview image. I was able to get all of the share options by adding a blank message to the ShareLink.

ShareLink(item: "FuzzBot Export", message: Text(""), 
     preview: SharePreview("FuzzBot Export", image: Image("fuzzbot")) )

Hope this helps!