title: CGPoint: Cannot call value of non-function type `[Float]`
body: <p>I am developing an app, which should draw points when is touch, in the location of touch and when I have got 2 or more points, it should connect these points and fill up the new object. </p>
  
  <pre><code>override func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) {
      if(draw == true){
  
          for touch in touches {
              let location = touch.location(in: view)
  
              pointsX.append(Float(location.x))
              pointsY.append(Float(location.y))
  
              let touchIndicator = UIView(frame: CGRect(x: location.x - 10, y: location.y - 10, width: 20, height: 20))
              touchIndicator.alpha = 0.8
              touchIndicator.backgroundColor = UIColor.red
              touchIndicator.layer.cornerRadius = 10
              self.view.addSubview(touchIndicator)
              touchIndicators.append(touchIndicator)
          }
  
      }
  }
  </code></pre>
  
  <p>Everytime i save the x and y coordinates in float type into array pointX and pointsY. But when i need to draw a line between 2 points, it tells me an error Cannot call value of non-function type <code>[Float]</code>.</p>
  
  <pre><code>let squarePath = UIBezierPath()
  
      squarePath.move(to: CGPoint(x: pointsX(0), y: pointsY(0)))
  
      squarePath.addLine(to: CGPoint(x: 200, y: 100))
      squarePath.addLine(to: CGPoint(x: 200, y: 200))
  
  
  
      squarePath.close()
  
      let square = CAShapeLayer()
      square.path = squarePath.cgPath
      square.fillColor = UIColor.red.cgColor
      self.view.layer.addSublayer(square)
  </code></pre>
  
  <p>Is there any other solution, where can I save my CGPoints? </p>
  
  <p>If I can ask for a code, that will be easier for me, I am not good in english, thank you.</p>