AR quick look integration

Hello, I struggling to integrate this code below in my Content View can someone give me help?

import UIKit
import QuickLook
import ARKit


class ViewController: UIViewController, QLPreviewControllerDataSource {

    override func viewDidAppear(_ animated: Bool) {
        let previewController = QLPreviewController()
        previewController.dataSource = self
        present(previewController, animated: true, completion: nil)

    }


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

    func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
        guard let path = Bundle.main.path(forResource: "myScene", ofType: "reality") else { fatalError("Couldn't find the supported input file.") }

        let url = URL(fileURLWithPath: path)

        return url as QLPreviewItem

    }

}

Replies

Sorry I didn't express myself clearly. I want to turn this UIKit view into a SwiftUI view. How can I do that?

Add a Comment