Skip to content

Instantly share code, notes, and snippets.

View asingh33's full-sized avatar
💭
I may be slow to respond.

Abhishek Singh asingh33

💭
I may be slow to respond.
View GitHub Profile
@asingh33
asingh33 / PDFDocView.swift
Created May 9, 2021 16:11
Context based Draw function, which does the actual rendering of annotations.
// 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)
@asingh33
asingh33 / DocumentView.swift
Created May 10, 2020 04:29
Using PDFViewUI structure object in SwiftUI framework
struct DocumentView: View {
var document: UIDocument
var dismiss: () -> Void
var pdfView: PDFViewUI!
var body: some View {
VStack {
pdfView
Button("Done", action: dismiss)
@asingh33
asingh33 / DocumentView.swift
Last active May 10, 2020 04:27
Create a UIView subclass wrapper for PDFView
// 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()