// The MIT License (MIT) // // Copyright (c) 2020–2022 Alexander Grebenyuk (github.com/kean). import SwiftUI #if os(iOS) import PDFKit struct PDFKitRepresentedView: UIViewRepresentable { let document: PDFDocument func makeUIView(context: Context) -> PDFView { let pdfView = PDFView() pdfView.document = document return pdfView } func updateUIView(_ view: PDFView, context: Context) { // Do nothing } } #elseif os(macOS) import PDFKit struct PDFKitRepresentedView: NSViewRepresentable { let document: PDFDocument func makeNSView(context: Context) -> PDFView { let pdfView = PDFView() pdfView.document = document pdfView.autoScales = true return pdfView } func updateNSView(_ view: PDFView, context: Context) { // Do nothing } } #endif