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

# class(forFileType:)

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

```
class func `class`(forFileType type: String) -> AnyClass?
```

## Parameters

`type`

A string containing the filename extension or an encoded HFS type.

## Return Value

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

## Discussion

---

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)