---
title: WebDocumentView
framework: webkit
role: symbol
role_heading: Protocol
path: webkit/webdocumentview
---

# 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:) method. Classes that adopt this protocol are expected to be subclasses of NSView.

## Declaration

```swift
protocol WebDocumentView : NSObjectProtocol
```

## Topics

### Setting the data source

- [setDataSource(_:)](webkit/webdocumentview/setdatasource(_:).md)
- [dataSourceUpdated(_:)](webkit/webdocumentview/datasourceupdated(_:).md)

### Controlling the layout

- [setNeedsLayout(_:)](webkit/webdocumentview/setneedslayout(_:).md)
- [layout()](webkit/webdocumentview/layout().md)

### Attaching to a window

- [viewDidMoveToHostWindow()](webkit/webdocumentview/viewdidmovetohostwindow().md)
- [viewWillMove(toHostWindow:)](webkit/webdocumentview/viewwillmove(tohostwindow:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Working With Document Web Views (Legacy)

- [WebDocumentRepresentation](webkit/webdocumentrepresentation.md)
- [WebDocumentSearching](webkit/webdocumentsearching.md)
- [WebDocumentText](webkit/webdocumenttext.md)
