I am just trying to set two flags for the debug options. Why is this a problem in Swift 4
Asked
Active
Viewed 1,027 times
3
-
Same problem as in https://stackoverflow.com/questions/30761996/swift-2-0-binary-operator-cannot-be-applied-to-two-uiusernotificationtype and https://stackoverflow.com/questions/30867325/binary-operator-cannot-be-applied-to-two-uiviewautoresizing-operands (from the "Related" section). – Martin R Jun 13 '17 at 05:18
2 Answers
9
instead of doing "|", use a set:
sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints,ARSCNDebugOptions.showWorldOrigin]
Michael Dautermann
- 88,797
- 17
- 166
- 215
0
SCNDebugOptions confirm the protocol OptionSet, which confirm SetAlgebra protocol and SetAlgebra confirm ExpressibleByArrayLiteral protocol.
public struct SCNDebugOptions : OptionSet {...}
protocol OptionSet : RawRepresentable, SetAlgebra {...}
public protocol SetAlgebra : Equatable, ExpressibleByArrayLiteral {...}
That's why you can't use the pipe (|) sign for multiple arguments. instead, use an array.
sceneView.debugOptions = [.showFeaturePoints, .showWorldOrigin]
Tapas Pal
- 7,073
- 8
- 39
- 86
