# Superwall

The shared instance of Superwall that provides access to all SDK features.

> **Note**

You must call [`configure()`](/docs/ios/sdk-reference/configure) before accessing `Superwall.shared`, otherwise your app will crash.



Purpose [#purpose]

Provides access to the configured Superwall instance after calling [`configure()`](/docs/ios/sdk-reference/configure).

Signature [#signature]

```swift
public static var shared: Superwall { get }
```

Parameters [#parameters]

This is a computed property with no parameters.

Returns / State [#returns--state]

Returns the shared `Superwall` instance that was configured via [`configure()`](/docs/ios/sdk-reference/configure).

Usage [#usage]

Configure first (typically in AppDelegate or SceneDelegate):

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

Then access throughout your app:

```swift
Superwall.shared.register(placement: "feature_access") {
  // Feature code here
}
```

Set user identity and attributes:

```swift
Superwall.shared.identify(userId: "user123")

Superwall.shared.setUserAttributes([
  "plan": "premium",
  "signUpDate": Date()
])
```

Reset the user:

```swift
Superwall.shared.reset()
```

> **Note**

Avoid calling `Superwall.shared.reset()` repeatedly. Resetting rotates the anonymous user ID, clears local paywall assignments, and requires the SDK to re-download configuration state. Only trigger a reset when a user explicitly logs out or you intentionally need to forget their identity. See [User Management](/docs/ios/quickstart/user-management) for more guidance.



Set delegate:

```swift
Superwall.shared.delegate = self
```

Override products:

```swift
Superwall.shared.overrideProductsByName = [
  "primary": "produceID_to_replace_primary_product"
]
```

Access customer info:

```swift
// Get current customer info
let customerInfo = Superwall.shared.customerInfo

// Get customer info asynchronously
let customerInfo = await Superwall.shared.getCustomerInfo()

// Observe customer info changes
Superwall.shared.$customerInfo
  .sink { customerInfo in
    print("Customer has \(customerInfo.subscriptions.count) subscriptions")
  }
  .store(in: &cancellables)
```

Set integration attributes:

```swift
Superwall.shared.setIntegrationAttributes([
  .amplitudeUserId: "user123",
  .mixpanelDistinctId: "distinct456",
  .firebaseInstallationId: "abc123"
])
```

Get device attributes:

```swift
let deviceAttributes = await Superwall.shared.getDeviceAttributes()
// Use in audience filters or for debugging
print("Device attributes: \(deviceAttributes)")
```

Confirm all experiment assignments:

```swift
// Get all experiment assignments
let assignments = await Superwall.shared.confirmAllAssignments()
print("Confirmed \(assignments.count) assignments")
```

Manually refresh configuration (development-only):

```swift
// Useful when hot-reloading paywalls during development
await Superwall.shared.refreshConfiguration()
```