I am trying to display a preview of files (like PDF, Pages, Microsoft Docs) in my SwiftUI application for MacOS.
I found Apple's QuickLook framework, which looks perfect for that use. Can I use it in SwiftUI? If I look up the documentation at Apple, I find the QLPreviewController
which is a UIViewController.
My approach would, to wrap that UIViewController into a SwiftUI view.. is that the best way? Has anyone tried to do that already?
Summary: how can I display file previews in my SwiftUI MacOS app?
So, I figured it out finally.
I was able to use the QLPreviewView
, which generates a preview view for me. I wrapped it inside a NSViewRepresentable
and it worked :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.