I have created an SwiftUI app that used to fetch Olevel past-paper in website, and I use JSON to store the paper name and URL. It'll always return a pdf file on my application. And the problem is: I want to add an shared button in my detailed view(See the second picture) to let people share this pdf file to other people using AirDrop or Messenger app. But unfortunately, I can't find any useful content related to my problem although there're shared button everywhere...
import SwiftUI
struct OEng19ListView: View {
var body: some View {
NavigationView {
VStack{
OEng19List()
}
.navigationBarTitle(Text("2019"))
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
struct OEng19List: View {
var body: some View {
List(OEng19Data) { xxx in
NavigationLink(destination: OEng19Detail(xxx: xxx)) {
OEng19Row(xxx: xxx)
}
}
}
}
struct OEng19Row: View {
var xxx: OEng19
var body: some View {
HStack {
Text(xxx.name)
.frame(width: 230, height: 45, alignment: .leading)
Spacer()
}
}
}
struct OEng19Detail: View {
var xxx: OEng19
var body: some View {
VStack {
Webview(url: (xxx.url))
}
.navigationBarTitle(Text(xxx.name), displayMode: .inline)
}
}
Here's my SwiftUI code about my listView and detailed view. Please help me, THANKS!!!