<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKMapView/register(_:forAnnotationViewWithReuseIdentifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKMapView(im)registerClass:forAnnotationViewWithReuseIdentifier:"
  },
  "title" : "register(_:forAnnotationViewWithReuseIdentifier:)"
}
-->

# register(_:forAnnotationViewWithReuseIdentifier:)

Registers an annotation view class that the map can create automatically.

```
func register(_ viewClass: AnyClass?, forAnnotationViewWithReuseIdentifier identifier: String)
```

## Parameters

`viewClass`

The class of an annotation view that you use in your map. The class needs to be a subclass of [`MKAnnotationView`](/documentation/MapKit/MKAnnotationView).

`identifier`

The reuse identifier to associate with the specified class. This parameter can’t be `nil` or an empty string.

## Discussion

Use this method to register one or more views that you use to display annotations on your map. Register your classes before adding any annotations to the map.

When you register an annotation view class using this method, the [`dequeueReusableAnnotationView(withIdentifier:for:)`](/documentation/MapKit/MKMapView/dequeueReusableAnnotationView(withIdentifier:for:)) method uses the provided identifier to create the view that you register. It creates a new view only if an existing view isn’t available for reuse.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)