<!--
{
  "documentType" : "article",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/working-with-frames-legacy",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Working with Frames (legacy)"
}
-->

# Working with Frames (legacy)

## Topics

### Working with Frames (Legacy)

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

A `WebFrame` object encapsulates the data displayed in a `WebFrameView` object. There is one `WebFrame` object per frame displayed in a `WebView`. An entire webpage is represented by a hierarchy of `WebFrame` objects in which the root object is called the **main frame**.

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

`WebDataSource` encapsulates the web content to be displayed in a web frame view. A `WebDataSource` object has a representation object, conforming to the `WebDocumentRepresentation` protocol, that holds the data in an appropriate format depending on the MIME type. You can extend WebKit to support new MIME types by implementing your own view and representation classes, and specifying the mapping between them using the  [`registerClass(_:representationClass:forMIMEType:)`](/documentation/WebKit/WebView-swift.class/registerClass(_:representationClass:forMIMEType:)) `WebView` class method.

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

`WebFrameView` objects and their subviews display the web content contained in a frame. You never create instances of `WebFrameView` directly—`WebView` objects create and manage a hierarchy of `WebFrameView` objects, one for each frame. `WebFrameView` objects use a scroll view whose document view conforms to the [`WebDocumentView`](/documentation/WebKit/WebDocumentView) protocol.

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



---

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)