ARPlaneAnchor's 'extent' property deprecated

423 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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 }