<!--
{
  "documentType" : "article",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/working-with-document-web-views-legacy",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Working With Document Web Views (Legacy)"
}
-->

# Working With Document Web Views (Legacy)

## Topics

### Working With Document Web Views (Legacy)

[`WebDocumentRepresentation`](/documentation/WebKit/WebDocumentRepresentation)

This protocol is adopted by document representation classes that handle specific MIME types. You can implement your own document view classes and document representation classes to render data for specific MIME types, and register those classes using the `WebFrame` [`registerClass(_:representationClass:forMIMEType:)`](/documentation/WebKit/WebView-swift.class/registerClass(_:representationClass:forMIMEType:)) method.

[`WebDocumentSearching`](/documentation/WebKit/WebDocumentSearching)

`WebDocumentSearching` is an optional protocol for document view objects that support searching. Classes that adopt this protocol should also adopt `WebDocumentView` and inherit from `NSView`.

[`WebDocumentText`](/documentation/WebKit/WebDocumentText)

`WebDocumentText` is an optional protocol for document view objects that display text. This protocol defines methods for accessing document content as strings, and methods for text selection. Classes that adopt this protocol should also adopt [`WebDocumentView`](/documentation/WebKit/WebDocumentView) and inherit from `NSView`.

[`WebDocumentView`](/documentation/WebKit/WebDocumentView)

This protocol is adopted by the document view of a `WebFrameView`. You can extend WebKit to support additional MIME types by implementing your own document view and document representation classes to render data for specific MIME types. You register those classes using the WebFrame [`registerClass(_:representationClass:forMIMEType:)`](/documentation/WebKit/WebView-swift.class/registerClass(_:representationClass:forMIMEType:)) method. Classes that adopt this protocol are expected to be subclasses of `NSView`.



---

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)