So I want to view pdf from core data but stuck on this issue
struct PDFView: View {
var pdfData: Data?
var body: some View {
if let pdfData = pdfData, let document = PDFDocument(data: pdfData) {
PDFKitView(document: document)
} else {
Text("PDF Not Found")
}
}
}
struct PDFKitView: UIViewRepresentable { // Type 'PDFKitView' does not conform to protocol 'UIViewRepresentable'
let document: PDFDocument
func makeUIView(context: Context) -> PDFView {
PDFView()
}
func updateUIView(_ uiView: PDFView, context: Context) {
uiView.document = document // Value of type 'PDFView' has no member 'document'
}
}
I have google it and look on similar question but it doesn't help me.
any suggestion on how to make the PDFKitView conform to protocol 'UIViewRepresentable' and dix "Value of type 'PDFView' has no member 'document'"?