Deep Links & In-App Previews
It's important to tell Superwall when a deep link has been opened. This enables two things
- Previewing paywalls on your device before going live
- Deep linking to specific Campaigns
If you don't have a custom URL scheme already set up, see Adding a Custom URL Scheme.
Depending on whether your app uses a SceneDelegate, AppDelegate, or is written in SwiftUI, there are different ways to tell Superwall that a deep link has been opened.
Be sure to click the tab that corresponds to your architecture:
import Paywall
class AppDelegate: UIResponder, UIApplicationDelegate {
// NOTE: if your app uses a SceneDelegate, this will NOT work!
// Handle a deep link
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
Paywall.handleDeepLink(url)
return true
}
}
import Paywall
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// for cold launches
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let url = connectionOptions.urlContexts.first?.url {
Paywall.handleDeepLink(url)
}
}
// for when your app is already running
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
Paywall.handleDeepLink(url)
}
}
}
import Paywall
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
Paywall.handleDeepLink(url) // handle your deep link
}
}
}
}
Next, build and run your app on your phone.
Then, head to the Superwall Dashboard. Click on the cog icon in the top right corner, then select Settings:

With the General tab selected, type your custom URL scheme, without slashes, into the Apple Custom URL Scheme field:
Next, open your paywall from the dashboard and click Preview. You'll see a QR code appear in a pop-up:
On your device, scan this QR code. You can do this via Apple's Camera app. This will take you to a paywall viewer within your app, where you can preview all your paywalls in different configurations.
Here's an example of the full paywall preview flow once you're up and running:
Updated 2 months ago