---
title: WebArchive
framework: webkit
role: symbol
role_heading: Class
path: webkit/webarchive
---

# WebArchive

A WebArchive object represents a webpage that can be archived—for example, archived on disk or on the pasteboard. A WebArchive object contains the main resource, as well as the subresources and subframes of the main resource. The main resource can be an entire webpage, a portion of a webpage, or some other kind of data such as an image. Use this class to archive webpages, or place a portion of a webpage on the pasteboard, or to represent rich web content in any application.

## Declaration

```swift
class WebArchive
```

## Topics

### Initializing

- [init(mainResource:subresources:subframeArchives:)](webkit/webarchive/init(mainresource:subresources:subframearchives:).md)
- [init(data:)](webkit/webarchive/init(data:).md)

### Getting attributes

- [mainResource](webkit/webarchive/mainresource.md)
- [subresources](webkit/webarchive/subresources.md)
- [subframeArchives](webkit/webarchive/subframearchives.md)
- [data](webkit/webarchive/data.md)

### Constants

- [WebArchivePboardType](webkit/webarchivepboardtype.md)

### Initializers

- [init(coder:)](webkit/webarchive/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Related Documentation

- [WebKit Objective-C Programming Guide](apple-archive/documentation/Cocoa/Conceptual/DisplayWebContent.md)
