<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImageRep/class(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImageRep(cm)imageRepClassForData:"
  },
  "title" : "class(for:)"
}
-->

# class(for:)

Returns the image representation subclass that handles the specified type of data.

```
class func `class`(for data: Data) -> AnyClass?
```

## Parameters

`data`

The image data.

## Return Value

A `Class` object for the image representation that can handle the data, or `nil` if no image representation could handle the data.

---

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)