I am trying to bind fileurls array to NavigationLink list I have an error
Cannot convert value of type 'Binding<[URL]>' to expected argument type 'Range'
struct ContentView: View {
@State private var fileUrls:[URL] = []
func listDir(dir: String) -> [URL] {
// list file from directory
}
var body: some View {
NavigationView {
ZStack {
VStack {
List{
ForEach($fileUrls) { object in
NavigationLink(destination: PDFKitView(url: self.fileUrl1), isActive: $viewLocalPDF) {
Button("Swift Style"){
self.viewLocalPDF = true
}.padding(.bottom, 20)
}
}
}
}
.navigationBarTitle("Bookshelv ", displayMode: .inline).onAppear {
fileUrls = listDir(dir: "pdfs")
}
}
}
}