This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Context based Draw function, which does the actual rendering of annotations. | |
override func draw(with box: PDFDisplayBox, in context: CGContext) { | |
if( path == nil){ | |
return | |
} | |
let localPath = path.copy() as! UIBezierPath | |
super.draw(with: box, in: context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct DocumentView: View { | |
var document: UIDocument | |
var dismiss: () -> Void | |
var pdfView: PDFViewUI! | |
var body: some View { | |
VStack { | |
pdfView | |
Button("Done", action: dismiss) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This struct will return pdfView in UIView form to make it SwiftUI compatible | |
struct PDFViewUI : UIViewRepresentable { | |
var url: URL? | |
init(url : URL) { | |
self.url = url | |
} | |
func makeUIView(context: Context) -> UIView { | |
let pdfView = PDFView() |