# Debugging

The Purchases SDK includes a debug overlay that allows developers to see various configuration details while running an app. You can read more about the debug overlay in our [Debugging](πŸ”—ο»Ώ) guide.

# SwiftUI Previews

SwiftUI Previews allow developers to preview their views directly in Xcode without building and running your app. The Purchases SDK includes convenience types for displaying mock products and offerings to avoid having to build and run your app to test your paywall.

ο»Ώ

# SDK Initialization

We recommend following our [guide](πŸ”—ο»Ώ) for more information on configuring the Purchases SDK. However, we detail multiple methods for configuring the SDK in SwiftUI below.

## Option 1: App Init

For basic initialization without delegate methods, you can implement the App `init` method:

ο»Ώ

## Option 2: App Delegate

Another method of initialization is to use the `@UIApplicationDelegateAdaptor` property wrapper to configure the Purchases SDK. The `@UIApplicationDelegateAdaptor` gives the option of using UIApplicationDelegate methods that are traditionally used in UIKit applications.

### Creating a Delegate

Begin by creating a delegate class and initializing the _Purchases_ SDK like the following:

ο»Ώ

### Attaching the Delegate

As previously mentioned, the new `@UIApplicationDelegateAdaptor` property attaches the delegate to the new SwiftUI App struct. Add the property wrapper like the following:

ο»Ώ

Build and run the app, and _Purchases_ will be initialized on app launch.

For more information on configuring the SDK, check out the [Configuring SDK](πŸ”—ο»Ώ) guide.