<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebArchive/init(mainResource:subresources:subframeArchives:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebArchive(im)initWithMainResource:subresources:subframeArchives:"
  },
  "title" : "init(mainResource:subresources:subframeArchives:)"
}
-->

# init(mainResource:subresources:subframeArchives:)

Initializes the receiver with a resource and optional subresources and subframe archives..

```
init!(mainResource: WebResource!, subresources: [Any]!, subframeArchives: [Any]!)
```

## Discussion

This method initializes and returns the receiver by setting the main resource to `mainResource`, and setting the subresources and subframe archives if supplied. The `subresources` argument should be an array of WebResource objects or `nil` if none are specified. The `subframeArchives` should be and array of WebArchive objects used by the subframes or `nil` if none are specified.

---

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)