---
title: "init(frame:configuration:)"
framework: webkit
role: symbol
role_heading: Initializer
path: "webkit/wkwebview/init(frame:configuration:)"
---

# init(frame:configuration:)

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

## Declaration

```swift
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 doc://com.apple.webkit/documentation/WebKit/WKWebViewConfiguration.

## Return Value

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

## Discussion

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 init(frame:) method.

## See Also

### Creating a web view

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