0
votes

When using QLPreviewController to display a .usdz 3D Object.

There are 2 viewing modes: AR and Object

By default, AR is selected. I'd like the default selected to be "Object" and would like to also disable the Switch so that they can't view it in AR mode. Is this possible?

enter image description here enter image description here

Here is my subclassed QLPreviewController:

import UIKit
import ARKit
import QuickLook


class ARQLViewController: QLPreviewController, 
QLPreviewControllerDataSource {
var fileURL: URL!

override func viewDidLoad() {
    super.viewDidLoad()
    dataSource = self
}

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

func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
    let item = ARQuickLookPreviewItem(fileAt: fileURL)
    item.canonicalWebPageURL = nil
    return item
}

}
1
What if you change the extension to usd or usda?EmilioPelaez
I don't think the MIME makes a difference. I think it comes down to the limitations of QLPreviewController regardless of MIME. e.g.: others are also having trouble hiding that share button in top right. So, it may be that is is impossible or extremely difficult to modify that customized navbargrantespo
Yes, the QLPreviewController is famously uncustomizable. Maybe changing the extension is not enough, but you could read the file, export as obj or another 3D supported format, and pass that to the preview controller.EmilioPelaez
Since QLPreviewController has an awful forced UX. I resorted to viewing using .obj files with Scenekitgrantespo

1 Answers

0
votes

As EmilioPelaez mentioned, QLPreviewController is uncustomizable.

to view a 3d Object, I am no longer using .usdz files, but using obj files + SceneKit