1

I'm using ARKit to build an AR app with SceneKit. When I was creating an SCNPlane object when SceneKit detected a horizontal plane using ARPlaneAnchor's extent of x and y properties I ran into this warning:

// *'extent' was deprecated in iOS 16*

My sample code is below:

let planeAnchor = anchor as! ARPlaneAnchor

let plane = SCNPlane(width: CGFloat(planeAnchor.extent.x), 
                    height: CGFloat(planeAnchor.extent.z))

How can I work around this?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
NhlanhlaNkosi
  • 573
  • 1
  • 4
  • 8

1 Answers1

1

Use planeExtent property instead, with width, height & rotationOnYAxis sub-properties.

@available(iOS 16.0, *)
open var planeExtent: ARPlaneExtent { get }

In iOS 16.0 and higher, extend property is deprecated:

@available(iOS, introduced: 11.0, deprecated: 16.0)
open var extent: simd_float3 { get }
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220