USDZ Preview missing AR option after iOS 15

Hi I am trying to display a USDZ model in my app using code similar to that described here:
https://developer.apple.com/documentation/arkit/previewing_a_model_with_ar_quick_look
however, after updating to iOS 15 and Xcode 13 the option to toggle between the base model view and the AR view is no longer there, the share button is also missing.

I am using view inside a navigation view in SwiftUI with code as follows.

import SwiftUI

struct ModelView: View {
  var body: some View {
    ARQuickLookView()
  }
}

struct ModelView_Previews: PreviewProvider {
  static var previews: some View {
    ModelView()
  }
}
import SwiftUI
import QuickLook
import ARKit

struct ARQuickLookView: UIViewControllerRepresentable {
  var allowScaling: Bool = true
   
  func makeCoordinator() -> ARQuickLookView.Coordinator {
    Coordinator(self)
  }
   
  func makeUIViewController(context: Context) -> QLPreviewController {
    let controller = QLPreviewController()
    controller.dataSource = context.coordinator
    return controller
  }
   
  func updateUIViewController(_ controller: QLPreviewController,
                context: Context) {
    // nothing to do here
  }
   
  class Coordinator: NSObject, QLPreviewControllerDataSource {
    let parent: ARQuickLookView
     
    init(_ parent: ARQuickLookView) {
      self.parent = parent
      super.init()
    }
     
    func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
      return 1
    }
     
    func previewController(
     _ controller: QLPreviewController,
     previewItemAt index: Int) -> QLPreviewItem {
      let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("model.usdz")
      return url as QLPreviewItem
    }
     
  }
}

struct ARQuickLookView_Previews: PreviewProvider {
  static var previews: some View {
    ARQuickLookView()
  }
}

Any info on why I don't have these options and how I could get them back would be appreciated.

Thanks

Louis

  • same problem here. somehow was able to make AR when going to full screen, so I have only one View and it is ARQuickLookView

Add a Comment