title: How do I make an if statement for my rotating circle in Swift?
body: <p>I have this circle and it can rotate 360 degrees to the left and right when the user has their finger on the node and is rotating. I need to figure out how to make an if statement so when it rotates to the left I can add an action and when it rotates to the right I can add another action. Here is the code I have:</p>
  
  <pre><code>override func touchesMoved(touches: Set&lt;UITouch&gt;, withEvent event: UIEvent?) {
  
      for touch in touches {
          let location = touch.locationInNode(self)
          let node = self.nodeAtPoint(location)
  
  
          if node.name == "rotatecircle" {
  
  
              //lets user rotate circle like a knob when there is one finger on node.
              let dy = circle.position.y - location.y
              let dx = circle.position.x - location.x
              let angle2 = atan2(dy, dx)
              circle.zRotation = angle2
  
          } 
           } 
            }
  </code></pre>