---
title: "init(identifier:)"
framework: webkit
role: symbol
role_heading: Initializer
path: "webkit/webpreferences/init(identifier:)"
---

# init(identifier:)

Returns an initialized WebPreferences object, creating one if it does not exist.

## Declaration

```swift
init!(identifier anIdentifier: String!)
```

## Parameters

- `anIdentifier`: A unique identifier for the doc://com.apple.webkit/documentation/WebKit/WebPreferences object

## Return Value

Return Value A newly initialized WebPreferences object with the identifier; if an existing WebPreferences object with that identifier exists, it is returned instead.

## Discussion

Discussion The anIdentifier argument should be unique—it is prepended to the keys used to store the receiver’s attributes in the user defaults database. WebView objects can share a WebPreferences object by using the same preferences identifier. Typically, you do not invoke this method directly. Instead, you set the preferences identifier by sending a preferencesIdentifier message to your WebView object. This method is the designated initializer for the WebPreferences class.

## See Also

### Related Documentation

- [identifier](webkit/webpreferences/identifier.md)
