title: Best practice for 2000+ annotations in MapKit
body: <p>I have a JSON file which contains around 2,000 locations that I need to display on the map when the map camera altitude is less than 750 metres high. Here is my current code:</p>
  
  <pre><code>func addStops() {
      var path: String! = NSBundle.mainBundle().pathForResource("stops", ofType: "json")
      var jsonData: NSData! = NSData(contentsOfFile: path)
      var jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(jsonData, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
      self.busStops = jsonResult["results"] as NSArray
  
      for (var i = 0; i &lt; self.busStops.count; i++) {
          let lat = self.busStops[i]["latitude"] as NSString
          let lng = self.busStops[i]["longitude"] as NSString
  
          var annotation = busAnno()
          annotation.setCoordinate(CLLocationCoordinate2DMake(CLLocationDegrees(lat.doubleValue), CLLocationDegrees(lng.doubleValue)))
          annotation.type = "stop"
          self.mapView.addAnnotation(annotation)
      }
  }
  </code></pre>
  
  <p>And the annotation view delegate:</p>
  
  <pre><code>func mapView (mapView: MKMapView!, viewForAnnotation annotation: MKPointAnnotation!) -&gt; busMarker! {
      var pinView = MKAnnotationView(annotation: annotation, reuseIdentifier: "point")
      pinView.location = annotation.location
      pinView.hidden = true
      pinView.layer.hidden = true
      pinView.enabled = false
  }
  </code></pre>
  
  <p>I thought I could get away with just hiding the views, but it takes a good 20 seconds before the application even responds after adding the markers, and then it's impossible to move the map around smoothly (drops to about 5 frames per second).</p>
  
  <p>So if I can't do that, what is a better approach? I'm guessing that checking if a pair of coordinates is within the screen's bounds every time the map moves won't work well due to lag (based on checking 2000 coordinates every time). Any ideas?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>You will only ever see about 10 annotations of the 2000 as you have to be very zoomed in to see any. It's just a case of which method I use to quickly find annotations in the region without this horrendous lag. </p>