Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  PDFKitRepresentedView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 4/26/22.
6
//
7
import PDFKit
8
import SwiftUI
9
 
10
struct PDFKitRepresentedView: UIViewRepresentable {
11
    typealias UIViewType = PDFView
12
 
13
    let url: URL
14
 
15
    init(_ url: URL) {
16
        self.url = url
17
    }
18
 
19
    func makeUIView(context _: UIViewRepresentableContext<PDFKitRepresentedView>) -> UIViewType {
20
        // Create a `PDFView` and set its `PDFDocument`.
21
        let pdfView = PDFView()
22
        pdfView.document = PDFDocument(url: url)
23
        pdfView.autoScales = true
24
 
25
        return pdfView
26
    }
27
 
28
    func updateUIView(_ pdfView: UIViewType, context _: UIViewRepresentableContext<PDFKitRepresentedView>) {
29
        pdfView.document = PDFDocument(url: url)
30
    }
31
}