title: How to draw line point by point in Swift
body: <p>I realised that I'm misusing the data retrived from the server in my tracker app. So I have this:</p>
  
  <pre><code> @objc private func updateOnlineTrackWithNewData() {
  
      print("Tick")
  
      if let track = track {
  
          guard track.status == 1 else { return } // is track online?
  
          serverManager.tracks.updateOnlineTrack(for: track, success: { (trackNewPoints) in 
         //receive new data
  
              guard trackNewPoints.count &gt; 1 else { return }
  
              for point in trackNewPoints {
  
                  self.track?.points?.append(point)
  
                  self.performSelector(onMainThread: #selector(self.updateOnlineTrackOnMap), with: nil, waitUntilDone: true)
  
              }
  
          }) { (error) in
  
              print(error ?? "Error updating online track")
  
             }
      }
  }
  </code></pre>
  
  <p>Where trackNewPoints is basically an array of points that I'm appending to the main "track" and updateOnlineTrackOnMap is just printing it out. updateOnlineTrackWithNewData() function is triggered by timer, everything works correctly. But I want to draw line point by point to simulate realtime movement. How can I achieve that? performSelector doesn't seem to work.</p>
  
  <p>Every 10 seconds I have 10 new points or so if that helps.</p>