二进制运算符不能应用于两个SCNDebugOptions

时间:2017-06-13 03:20:20

标签: swift scenekit

我只是想为调试选项设置两个标志。为什么这是Swift 4中的一个问题

enter image description here

2 个答案:

答案 0 :(得分:9)

而不是" |",请使用集合:

sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints,ARSCNDebugOptions.showWorldOrigin]

答案 1 :(得分:0)

SCNDebugOptions确认协议OptionSet,该协议确认SetAlgebra协议,而SetAlgebra确认ExpressibleByArrayLiteral协议。

public struct SCNDebugOptions : OptionSet {...}
protocol OptionSet : RawRepresentable, SetAlgebra {...}
public protocol SetAlgebra : Equatable, ExpressibleByArrayLiteral {...}

这就是为什么不能将管道符号(|)用于多个参数的原因。而是使用数组。

sceneView.debugOptions = [.showFeaturePoints, .showWorldOrigin]