Why Apple's software engineers did remove ARPlaneDetection
enum and made ARWorldTrackingConfiguration.PlaneDetection
struct instead?
Was:
public enum ARPlaneDetection: UInt {
case .none
case .horizontal
}
Now:
public struct PlaneDetection: OptionSet {
public init(rawValue: UInt)
public var horizontal: ARWorldTrackingConfiguration.PlaneDetection { get }
public var vertical: ARWorldTrackingConfiguration.PlaneDetection { get }
}
What advantages does new PlaneDetection
struct have over obsolete ARPlaneDetection
enum in ARKit?
This all is because PlaneDetection
struct conforms to OptionSet
protocol which allows you to set multiple options for some settings like this plane detection
let options: ARWorldTrackingConfiguration.PlaneDetection = [.horizontal, .vertical]
let options: ARWorldTrackingConfiguration.PlaneDetection = []
... this is advantage of OptionSet
and this simply isn't possible with just enum.