Created
July 18, 2023 01:39
-
-
Save thanakijwanavit/8819871dfdcdb9539b2e32f105d7460c to your computer and use it in GitHub Desktop.
swiftui zoomable view
This file contains hidden or 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
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