# configure()

A static function that configures a shared instance of Superwall for use throughout your app.

> **Note**

This is a static method called on the `Superwall` class itself, not on the shared instance.



Purpose [#purpose]

Configures the shared instance of Superwall with your API key and optional configurations, making it ready for use throughout your app.

Signature [#signature]

```swift
public static func configure(
  apiKey: String,
  purchaseController: PurchaseController? = nil,
  options: SuperwallOptions? = nil,
  completion: (() -> Void)? = nil
) -> Superwall
```

Parameters [#parameters]

<TypeTable
  type="{
  apiKey: {
    type: &#x22;String&#x22;,
    description: &#x22;Your Public API Key from the Superwall dashboard settings.&#x22;,
    required: true,
  },
  purchaseController: {
    type: &#x22;PurchaseController?&#x22;,
    description: &#x22;Optional object for handling all subscription-related logic yourself. If `nil`, Superwall handles subscription logic.&#x22;,
    default: &#x22;nil&#x22;,
  },
  options: {
    type: &#x22;SuperwallOptions?&#x22;,
    typeDescriptionLink: &#x22;/ios/sdk-reference/SuperwallOptions&#x22;,
    description: &#x22;Optional configuration object for customizing paywall appearance and behavior.&#x22;,
    default: &#x22;nil&#x22;,
  },
  completion: {
    type: &#x22;(() -> Void)?&#x22;,
    description: &#x22;Optional completion handler called when Superwall finishes configuring.&#x22;,
    default: &#x22;nil&#x22;,
  },
}"
/>

Returns / State [#returns--state]

Returns the configured `Superwall` instance. The instance is also accessible via [`Superwall.shared`](/docs/ios/sdk-reference/Superwall).

Usage [#usage]

Basic configuration:

```swift
Superwall.configure(apiKey: "pk_your_api_key")
```

With custom options:

```swift
let options = SuperwallOptions()
options.paywalls.shouldShowPurchaseFailureAlert = false

Superwall.configure(
  apiKey: "pk_your_api_key",
  options: options
) {
  print("Superwall configured successfully")
}
```

With custom purchase controller:

```swift
Superwall.configure(
  apiKey: "pk_your_api_key",
  purchaseController: MyPurchaseController()
)
```