Mobile SDK
Embed a screen
Draw a screen inline inside your own layout, like an onboarding step or a pricing section.
Embedding draws a screen inside your own view instead of over the app. Use it for an onboarding step, a pricing section, a settings page or any place where the screen is part of the layout.
MiniwallView is a SwiftUI view.
struct PricingSection: View {
var body: some View {
MiniwallView(.placement("pricing"), options: options) { result in
if case .purchased = result { unlockPro() }
}
.frame(maxWidth: .infinity)
}
}MiniwallView(json: Data, ...) shows a bundled screen JSON.
Options
Embedding takes the same options as Present a screen except the display ones: there is no style, because the screen is part of your layout. A placement's display format and trigger are ignored for embedded screens.
| Parameter | What it does |
|---|---|
| Source | Required. Placement, paywall ID or JSON. |
| Options | products, variablesPerPackage, customVariables, locale, colorMode, screens, attributes and the callbacks. See Present a screen and Callbacks. |
onFinish | Called once with the result when the screen ends: purchased, restored, closed, action, or skipped. |
How it differs from present
- It stays in your layout. When the screen ends, your
onFinishruns and the view stays until you remove it from your own layout. Your callbacks run, and you decide what to do next. - Skipped placements draw nothing. If targeting skips,
onFinishreceivesskippedand the view stays empty. Make sure your layout still looks right, for example by showing a different section. - Load failures draw nothing. If the screen cannot be loaded the view stays empty and
onErroris called, instead of throwing. - Screens in a flow (with "Go to another screen" buttons) replace each other inside the view.
- No sheet or cover. The screen is as wide as the space you give it. Give the view the width you want.