I have a problem: I’m trying to open a share sheet from an alert, but the share sheet just does not open.
import SwiftUI
struct DocumentView: View {
// ...
@State private var newShare: Bool = false
@State private var newShareName: String = ""
var body: some View {
Form {
// ...
}
.alert("New share", isPresented: $newShare) {
TextField("Name", text: $newShareName)
Button("Cancel", role: .cancel) {}
ShareLink(item: URL(string: "https://www.demo.com/")!) {
Text("Share")
}
} message: {
Text("...")
}
}
}
I did shorten some parts of the code so it’s easier to read. Maybe you guys can help. I do appreciate it.