Big data with custom annotations in MKMapView, over 10k annotations

I used clustering annotations for display issues.

But I meet problem when my data gradually increase, detail:

  • I load annotation with my custom UIImageView and load Image from network to put into UIImageView
  • When 1k images => it no lagging from here. But when reach 10k images => view meet lagging.

Have any solution for big data on MKMapView?

Here is my code for annotation example

class PhotoAnnotationView: MKAnnotationView {
    private var imageView = UIImageView()

    override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
        super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)

        self.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
        self.imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
        self.addSubview(self.imageView)

        self.imageView.layer.cornerRadius = 5.0
        self.imageView.layer.masksToBounds = true
        
        self.canShowCallout = false
        self.clusteringIdentifier = "point"
    }
    
    override var annotation: MKAnnotation? {
        willSet {
            clusteringIdentifier = "point"
            
            if let mapAnnotation = newValue as? PhotoAnnotation, let url = URL(string: mapAnnotation.imageURL) {
                self.configure(with: url)
            }
        }
    }
    
    override var image: UIImage? {
        get {
            return self.imageView.image
        }

        set {
            self.imageView.image = newValue
        }
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func prepareForReuse() {
        super.prepareForReuse()
    }
    
    func configure(with imageURL: URL) {
        let options = ImageLoadingOptions(
            placeholder: nil,
            transition: .none
        )
        ****.loadImage(with: imageURL, options: options, into: imageView)
    }
}

I saw Apple Photos Map have large annotations but still can smoothly, how they can do that?

Big data with custom annotations in MKMapView, over 10k annotations
 
 
Q