I have a really simple task to update a node's color in a switch statement.
EDIT: This code is in InterfaceController of a watchOS app. It receives a message from an iOS app with the color string to set as the fill color.
The function with the switch logic looks something like this. Assuming the scene is already set up:
let b = SKShapeNode(rect:CGRect(x: 0, y: 0, width: 100, height: 100)
switch color {
case "red":
b.fillColor=UIColor.red
colorArea.scene?.addChild(b)
break
case: "blue":
b.fillColor=UIColor.blue
colorArea.scene?.addChild(b)
break
...
}
Now in the debugger I can see that it hits all the correct cases in the switch, and the scene is not nil to add a child. But, no matter what I have to hit the switch statement twice before the correct color will show up.
I mean that if I want to choose red, I trigger the red action once. It goes through the switch statement correctly and as expected, but nothing happens. The SECOND time I trigger the red action it will work just fine. (This happens for all colors in the switch)
I'm sure there is something simple I am missing... But I can't figure this. I Even have tried to remove all child nodes before the switch in case there was some weird over-lapping issues.