0

I want to extend my swiftUI app from iOS to watchOS and one of the features is to display PDF files . For my iOS app I had this code, which is not working for watchOS because the module PDFKit isn't available for watchOS:

import PDFKit
import SwiftUI

struct PDFKitRepresentedView: UIViewRepresentable {
    let pdf: PDFDocument
    
    init(pdf: PDFDocument) {
        self.pdf = pdf
    }
    
    func makeUIView(context: UIViewRepresentableContext<PDFKitRepresentedView>) -> PDFView {
        let pdfView = PDFView()
        pdfView.document = pdf
        pdfView.autoScales = true
        return pdfView
    }
    
    func updateUIView(_ uiView: PDFView, context: UIViewRepresentableContext<PDFKitRepresentedView>) {
        // Update the view;
    }
}

I didn't find any solutions yet. ChatGPT couldn't help either. Thanks for your help in advance!

tom
  • 1
  • 1

0 Answers0