<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebView/init(frame:configuration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebView(im)initWithFrame:configuration:"
  },
  "title" : "init(frame:configuration:)"
}
-->

# init(frame:configuration:)

Creates a web view and initializes it with the specified frame and configuration data.

```
init(frame: CGRect, configuration: WKWebViewConfiguration)
```

## Parameters

`frame`

The frame rectangle for the new web view.

`configuration`

The configuration of the new web view. This method saves a copy of your configuration object. Changes you make to your original object after calling this method have no effect on the web view’s configuration. For a list of configuration options and their default values, see [`WKWebViewConfiguration`](/documentation/WebKit/WKWebViewConfiguration).

## Return Value

An initialized web view, or `nil` if the view couldn’t be initialized.

## Discussion

This method is the designated initializer for the class. Use this method to create a web view that requires custom configuration. For example, use it when you need to specify custom cookies or content filters for the web content.

To create a web view with default configuration values, call the inherited <doc://com.apple.documentation/documentation/UIKit/UIView/init(frame:)> method.

---

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)