title: ARKit camera tracking state can’t show on SwiftUI
body: <p>I’m trying to show the camera tracking state info on top of device screen, but still get errors for all my efforts. I’m very confused with how ARView works with SwiftUI, for showing AR experience and adding button icons on top of it is simple, but to getting data from session just looks more work need to be done, could someone help me this? Thanks!</p>
  <p><em>Error in ViewModel: ‘description is a get-only property’</em></p>
  <blockquote>
  <p>Content View</p>
  </blockquote>
  <pre><code>import SwiftUI
  import ARKit
  import RealityKit
  
  struct ContentView: View {
      @StateObject var vm = ViewModel()
      
      var body: some View {
          ZStack{
              ARViewContainer()
                  .edgesIgnoringSafeArea(.all)
                  .environmentObject(vm)
              VStack{
                  Text(vm.sessionInfoLabel)
                      .font(.title3)
                      .foregroundColor(.red)
                  
                  Spacer()
                  HStack{
                      Button{
                          
                      } label: {
                          Image(systemName: &quot;person.2&quot;)
                              .padding()
                              .font(.title)
                      }
                      Spacer()
                      Button{
                          
                      } label: {
                          Image(systemName: &quot;target&quot;)
                              .padding()
                              .font(.title)
                      }
                  }
                  .padding()
                  
              }
          }
      }
  }
  
  struct ARViewContainer: UIViewRepresentable {
      @EnvironmentObject var vm: ViewModel
      func makeUIView(context: Context) -&gt; ARView {
          return vm.arView
      }
      
      func updateUIView(_ uiView: ARView, context: Context) {
      }
  }
  </code></pre>
  <blockquote>
  <p>ViewModel</p>
  </blockquote>
  <pre><code>import SwiftUI
  import ARKit
  import RealityKit
  
  class ViewModel: ObservableObject {
      @Published var arView: ARView
      var sessionInfoLabel = &quot;&quot;
      init() {
          arView = ARView.init(frame: .zero)
          let config = ARWorldTrackingConfiguration()
          config.planeDetection = .horizontal
          arView.session.delegate = arView
          arView.session.run(config)
      }
  }
  
  
  extension ARView: ARSessionDelegate {
      public func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
          camera.trackingState.description = ViewModel().sessionInfoLabel
      }
  }
  
  extension ARCamera.TrackingState: CustomStringConvertible {
      public var description: String {
          switch self {
          case .normal:
              return &quot;Normal&quot;
          case .notAvailable:
              return &quot;Not Available&quot;
          case .limited(.initializing):
              return &quot;Initializing&quot;
          case .limited(.excessiveMotion):
              return &quot;Excessive Motion&quot;
          case .limited(.insufficientFeatures):
              return &quot;Insufficient Features&quot;
          case .limited(.relocalizing):
              return &quot;Relocalizing&quot;
          case .limited:
              return &quot;Unspecified Reason&quot;
          }
      }
  }
  </code></pre>