---
title: "registerClass(_:representationClass:forMIMEType:)"
framework: webkit
role: symbol
role_heading: Type Method
path: "webkit/webview-swift.class/registerclass(_:representationclass:formimetype:)"
---

# registerClass(_:representationClass:forMIMEType:)

Specifies the view and representation objects to be used for specific MIME types.

## Declaration

```swift
class func registerClass(_ viewClass: AnyClass!, representationClass: AnyClass!, forMIMEType MIMEType: String!)
```

## Parameters

- `viewClass`: A class conforming to the doc://com.apple.webkit/documentation/WebKit/WebDocumentView protocol that displays the specified MIME types.
- `representationClass`: The class conforming to doc://com.apple.webkit/documentation/WebKit/WebDocumentRepresentation protocol that represents the specified MIME types.
- `MIMEType`: The MIME type of the content. This may be a primary MIME type or subtype. For example, if MIMEType is “video/” the specified view and representation objects are used for all video types. More specific subtype mappings, such as “image/gif”, takes precedence over primary type matching, such as “image/”.

## Discussion

Discussion After invoking this method, when MIMEType content is encountered, instances of representationClass and viewClass are created to handle and display it.

## See Also

### Registering Document Views and Representations

- [registerURLScheme(asLocal:)](webkit/webview-swift.class/registerurlscheme(aslocal:).md)
