Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Created July 18, 2023 01:39
Show Gist options
  • Save thanakijwanavit/8819871dfdcdb9539b2e32f105d7460c to your computer and use it in GitHub Desktop.
Save thanakijwanavit/8819871dfdcdb9539b2e32f105d7460c to your computer and use it in GitHub Desktop.
swiftui zoomable view
import SwiftUI
import PDFKit
struct PhotoDetailView: UIViewRepresentable {
let image: UIImage
func makeUIView(context: Context) -> PDFView {
let view = PDFView()
view.document = PDFDocument()
guard let page = PDFPage(image: image) else { return view }
view.document?.insert(page, at: 0)
view.autoScales = true
return view
}
func updateUIView(_ uiView: PDFView, context: Context) {
// empty
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment