Here's the entire app below. On iOS 15, it pops up blank. If you dismiss it and click "Share" again, then it looks right. Is this a bug, or is the code wrong?
struct ContentView: View {
@State private var showShare = false
@State private var shareItems: [Any] = []
var body: some View {
VStack {
Text("Test ActivityViewController")
Button("Share") {
share()
}.sheet(isPresented: $showShare) {
print("dismissed")
} content: {
ActivityViewController(activityItems: shareItems)
}
}
}
func share() {
shareItems = ["test"]
showShare = true
}
}
struct ActivityViewController: UIViewControllerRepresentable {
let activityItems: [Any]
func makeUIViewController(context: Context) -> UIActivityViewController {
let c = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
return c
}
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {}
}