<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionView/register(_:forSupplementaryViewOfKind:withReuseIdentifier:)-661io",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionView(im)registerClass:forSupplementaryViewOfKind:withReuseIdentifier:"
  },
  "title" : "register(_:forSupplementaryViewOfKind:withReuseIdentifier:)"
}
-->

# register(_:forSupplementaryViewOfKind:withReuseIdentifier:)

Registers a class for use in creating supplementary views for the collection view.

```
func register(_ viewClass: AnyClass?, forSupplementaryViewOfKind elementKind: String, withReuseIdentifier identifier: String)
```

## Parameters

`viewClass`

The class to use for the supplementary view.

`elementKind`

The kind of supplementary view to create. This value is defined by the layout object. This parameter must not be `nil`.

`identifier`

The reuse identifier to associate with the specified class. This parameter must not be `nil` and must not be an empty string.

## Discussion

Prior to calling the [`dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)`](/documentation/UIKit/UICollectionView/dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)) method of the collection view, you must use this method or the [`register(_:forSupplementaryViewOfKind:withReuseIdentifier:)`](/documentation/UIKit/UICollectionView/register(_:forSupplementaryViewOfKind:withReuseIdentifier:)-9hn73) method to tell the collection view how to create a supplementary view of the given type. If a view of the specified type isn’t currently in a reuse queue, the collection view uses the provided information to create a view object automatically.

If you previously registered a class or nib file with the same element kind and reuse identifier, the class you specify in the `viewClass` parameter replaces the old entry. You may specify `nil` for `viewClass` if you want to unregister the class from the specified element kind and reuse identifier.

---

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)