QLPreviewController with SwiftUI

I'm having a problem where any buttons won't be shown when displaying a QLPreviewController with swift.

With .quickLookPreview() these buttons are shown, including share, done, annotation etcetera. The buttons are not shown when using QLPreviewController with SwiftUI, however if used with other UIKit they are shown.

How to fix this? I'm not really looking forward in implementing all of the annotation functions and other QuickLook capabilities again.

The ultimate goal of mine is to allow annotation and other pdf editing with the ability to save the file via the Done button, but on .quickLookPreview() the Done button displays "Save to files" and "Discard" and on QLPreviewController the button is not shown.

The issue has been addressed on several forums, yet a solution has not been found.

Reproducement in nutshell:

  • new QLPreviewController conforming to UIViewControllerRepresentable
  • display the QLPreviewController in SwiftUI view

Thanks.

Answered by azi in 795847022

@toke0

I'd advise to follow the "Embed QLPreviewController in UINavigationController" example that is mentioned in the following blog post and not to use the SwiftUI modifier for your needs:

https://nilcoalescing.com/blog/PreviewFilesWithQuickLookInSwiftUI/

@toke0

I'd advise to follow the "Embed QLPreviewController in UINavigationController" example that is mentioned in the following blog post and not to use the SwiftUI modifier for your needs:

https://nilcoalescing.com/blog/PreviewFilesWithQuickLookInSwiftUI/

To add to @azi comment, I would also suggest you file a bug report using Feedback Assistant and post the Feedback number for the record. Thanks

QLPreviewController with SwiftUI
 
 
Q