NavigationLink from PDF

Hi there,

I am currently developing an app. I would like to make NavigationLinks from certain words inside an implemented .pdf-file to other Swift view files. Is there a possibility to do this?

Here is my code:

import PDFKit

struct BasismassnahmenPDF: UIViewRepresentable {

    let pdfDocument: PDFDocument

    init(showing pdfDoc: PDFDocument) {
        self.pdfDocument = pdfDoc
    }
    func makeUIView(context: Context) -> PDFView {
        let pdfView = PDFView()
        pdfView.document = pdfDocument
        pdfView.autoScales = true
        return pdfView
    }

    func updateUIView(_ pdfView: PDFView, context: Context) {
        pdfView.document = pdfDocument
        pdfView.minScaleFactor = 0.6
        pdfView.scaleFactor = pdfView.scaleFactorForSizeToFit
        
    }
}

struct Basismassnahmen: View {
    let pdfDoc: PDFDocument

        init() {
            let url = Bundle.main.url(forResource: "Basismassnahmen", withExtension: "pdf")!
            
            pdfDoc = PDFDocument(url: url)!
        }

        var body: some View {
            BasismassnahmenPDF(showing: pdfDoc)
        }
    }
#Preview {
    Basismassnahmen()
}

Thank you so much for your help!

Laurin

NavigationLink from PDF
 
 
Q