Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binary Operator Cannot be Applied to two SCNDebugOptions

Tags:

swift

scenekit

I am just trying to set two flags for the debug options. Why is this a problem in Swift 4

enter image description here

like image 354
john doe Avatar asked Jun 12 '26 06:06

john doe


2 Answers

instead of doing "|", use a set:

sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints,ARSCNDebugOptions.showWorldOrigin]
like image 162
Michael Dautermann Avatar answered Jun 13 '26 21:06

Michael Dautermann


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]
like image 31
Tapas Pal Avatar answered Jun 13 '26 22:06

Tapas Pal