iOS Annotations

How to add tag to annotations so that I can uniquely identify each annotations


You can check our “Search along a route” tutorial. It shows (step by step) how to create multiple annotations with custom view and uniquely identify them. Please find a full source code here:


Looking for solution in swift
Here is my usecase :
I got 10 places which am showing on map using Annotations. Now on click on any annotation, new view is displayed on the screen
I tried using AnnotationTag property but Error : says its read only property we cant assign any value

I’ve prepared small piece of code. I hope it’ll be helpful.

import UIKit
import TomTomOnlineSDKMaps

class CustomAnnotation : TTAnnotation {
    var uniqueDescription: String!
class ViewController: UIViewController, TTMapViewDelegate, TTAnnotationDelegate {
    @IBOutlet weak var mapView: TTMapView!
    var clickCounter: Int!
    override func viewDidLoad() {
        clickCounter = 1
        self.mapView.onMapReadyCompletion {
            self.mapView.delegate = self
            self.mapView.annotationManager.delegate = self

    func mapView(_ mapView: TTMapView, didLongPress clickedCoordinate: CLLocationCoordinate2D) {
        let annotation = CustomAnnotation(coordinate: clickedCoordinate)
        annotation.uniqueDescription = "myUniqueDescription\(String(clickCounter))"
        clickCounter += 1
        annotation.selectable = true

    func annotationManager(_ manager: TTAnnotationManager, annotationSelected annotation: TTAnnotation) {
        print((annotation as! CustomAnnotation).uniqueDescription!)

Let me know if the above solution is acceptable for you.