USDZ + QLPreviewController -> Can't hide share button

I've got a project that involves a few USDZ files for the augmented reality features embedded in the app. While this works great, and we're really happy with how it performs, the built in share button of the QLPreviewController is something that we'd like to remove. Subclassing the object doesn't have any effect, and trying to hide the rightBarButtonItem with the controller returned in delegate method still shows the button when a file is selected. The implementation of USDZ + QLPreviewController we're using is pretty basic. Is there a way around this issue?


func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
      return 1
 } 


func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
 
     let url = Bundle.main.url(forResource: models[selectedObject], withExtension: "usdz")! controller.navigationItem.rirButtonItems = nil. 
// <- no effect return url as QLPreviewItem 

}

 @IBAction func userDidSelectARExperience(_ sender: Any) { 
     let previewController = QLPreviewController() 
     previewController.dataSource = self 
     previewController.delegate = self 
     present(previewController, animated: true) 
}

Replies

Apparently, there is no way to change anything.