My current code is able to show the ActivityView, but does not show Airdrop, but that is not the main problem, i apologise for that, but i can't really fix the one, without fixing the other ...
func genCSV() -> String {
return "field1, field2"
}
struct ActivityViewController: UIViewControllerRepresentable {
var activityItems: [Any]
var applicationActivities: [UIActivity]? = nil
func makeUIViewController(context: UIViewControllerRepresentableContext<ActivityViewController>) -> UIActivityViewController {
let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities)
return controller
}
func updateUIViewController(_ uiViewController: UIActivityViewController, context: UIViewControllerRepresentableContext<ActivityViewController>) {}
}
Suppose the genCSV() fund actually returns valid CSV-Strings, how do I use it, to combine it with the ActivityViewController to send the generated CSV-File(obviously I still need to generate the file, that is my main problem right now)?
var body: some View {
NavigationView {
VStack {
HStack {
Button(action: { //action that triggers the sheet }) {
Image(systemName: "square.and.arrow.up")
.resizable()
.scaledToFit()
.padding(.all, 50)
.frame(width: 150, height: 150)
.background(Color.gray.brightness(0.18).opacity(0.5))
.clipShape(Circle())
}
.sheet(isPresented: self.$viewModel.airdropVisible) {
ActivityViewController(activityItems: [URL(string: "www.apple.com")!])
}
}
}
}
}
This is my current ContentView. Any helps or pointers are appreciated, I searched through a lot of Google results, and did not really find a good answer.
One Issue remaining also is, that Airdrop does not even show up in the ActivityViewController.