为什么苹果的软件工程师删除了ARPlaneDetectionenum并改为生成了ARWorldTrackingConfiguration.PlaneDetectionstruct?
是:

public enum ARPlaneDetection: UInt {
    case .none
    case .horizontal
}

现在:
public struct PlaneDetection: OptionSet {
    public init(rawValue: UInt)
    public var horizontal: ARWorldTrackingConfiguration.PlaneDetection { get }
    public var vertical: ARWorldTrackingConfiguration.PlaneDetection { get }
}

与arkit中过时的枚举相比,newPlaneDetectionstruct有哪些优势?

最佳答案

这都是因为PlaneDetectionstruct符合OptionSet协议,该协议允许您为某些设置(如平面检测)设置多个选项。

let options: ARWorldTrackingConfiguration.PlaneDetection = [.horizontal, .vertical]
let options: ARWorldTrackingConfiguration.PlaneDetection = []

…这是OptionSet的优点,而仅使用枚举是不可能的。

关于swift - ARKit - 为什么不再有'ARPlaneDetection'枚举?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55009346/

10-13 04:11