title: ios - Draw and Delete lines with SKShapeNode
body: <p>I want to draw a line via drag finger, now I can draw lines from first tap position to current position. But I can't delete the line I draw before. I use this code to delete lines.</p>
  
  <pre><code>for line in self.children {
      line.removeFromParent()
  }
  </code></pre>
  
  <p>But all of the deleted lines will appear when add a new line.</p>
  
  <p>There's my code below.</p>
  
  <pre><code>import SpriteKit
  import GameplayKit
  
  class GameScene: SKScene {
  
      private var label : SKLabelNode?
      private var spinnyNode : SKShapeNode?
  
      // For Line
      var startPoint: CGPoint?
      var path = CGMutablePath()
  
      override func didMove(to view: SKView) {
      }
  
  
      func touchDown(atPoint pos : CGPoint) {
          print("touchDown")
          startPoint = pos
      }
  
      func touchMoved(toPoint pos : CGPoint) {
          print("touchMoved")
  
          for line in self.children {
              line.removeFromParent()
          }
  
          plotLine(atPoint: startPoint!, toPoint: pos)
      }
  
      func plotLine(atPoint start: CGPoint, toPoint end: CGPoint) {
          path.move(to: start)
          path.addLine(to: end)
  
          let temp_shape = SKShapeNode()
          temp_shape.path = path
          temp_shape.strokeColor = UIColor.white
          temp_shape.lineWidth = 2
  
          self.addChild(temp_shape)
      }
  </code></pre>