SwiftUI open ShareLink from ActionSheet (confirmationDialog) Not Working

646 Views Asked by At

I have a ShareLink inside an ActionSheet (confirmationDialog) but it's not opening. Can anyone confirm if this is possible or not? I imagine it's something to do with the action sheet being dismissed at the same time.

.confirmationDialog("", isPresented: $isShowingMoreActionSheet, titleVisibility: .hidden) {
        
        if let url = URL(string: "https://www.google.com") {
            ShareLink("Share", item: url)
        }
    }
1

There are 1 best solutions below

0
On

The Sharelink actually is a button, which is documented in the developer tools:

People tap or click on a share link to present a share interface. The link typically uses a system-standard appearance for the link; you only need to supply the content to share.

Therefore a sharelink is not going to work within an if let

Hope this helps!