You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/ios/migration-to-ios-sdk-v4.mdx
+55-50Lines changed: 55 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,40 @@
1
1
---
2
2
title: "Migrate Adapty iOS SDK to v. 4.0"
3
-
description: "Migrate to Adapty iOS SDK v4.0 (beta) by replacing paywall builder methods with flow methods, compatible with both Paywall Builder and Flow Builder."
3
+
description: "Migrate to Adapty iOS SDK v4.0 (beta) by replacing paywall APIs with flow APIs, compatible with both Paywall Builder and Flow Builder."
Adapty iOS SDK 4.0 (beta) introduces new flow methods to replace the v3 paywall methods. The new flow methods work with both the Paywall Builder and the new Flow Builder — no setup changes are required on the Adapty Dashboard side. There are three things to know about the type changes:
7
+
Adapty iOS SDK 4.0 (beta) introduces flows and renames the paywall APIs accordingly. The new APIs work with both the Paywall Builder and the new Flow Builder — no setup changes are required on the Adapty Dashboard side.
8
8
9
-
-**`AdaptyFlow` is a new type.** It is a placement that wraps one or more paywalls — the value returned by the new `Adapty.getFlow(placementId:)` method.
10
-
-**`AdaptyPaywall` has been renamed to `AdaptyFlowPaywall`.** Code that previously held a single paywall now holds an `AdaptyFlowPaywall` (the type the SDK returns inside an `AdaptyFlow.paywalls` collection or via flow-builder APIs).
9
+
There are three things to know about the type changes:
10
+
11
+
-**`AdaptyFlow` is a new type.** It is a placement that wraps one or more paywalls — the value returned by the new `Adapty.getFlow(placementId:)` method. Code that previously held an `AdaptyPaywall` now holds an `AdaptyFlow`.
12
+
-**`AdaptyPaywall` has been renamed to `AdaptyFlowPaywall`.** It exists as an item inside `AdaptyFlow.paywalls`. Typical v3 migration paths don't interact with it directly — you'll encounter it only if you build flow-aware UI by walking `flow.paywalls`.
11
13
-**`AdaptyPaywallProduct` is unchanged.** Methods that returned `[AdaptyPaywallProduct]` still do — there is no `AdaptyFlowProduct`.
12
14
13
-
1. Replace `Adapty.getPaywall()` with `Adapty.getFlow()`.
14
-
2. Replace `AdaptyUI.getPaywallConfiguration(forPaywall:)` with `AdaptyUI.getFlowConfiguration(forFlow:)`.
15
-
3. Replace `AdaptyPaywallController` with `AdaptyFlowController` (UIKit).
16
-
4. Replace `AdaptyPaywallControllerDelegate` with `AdaptyFlowControllerDelegate` (UIKit).
17
-
5. Replace the SwiftUI `.paywall()` modifier with `.flow()`.
18
-
6. Replace `AdaptyPaywallView` with `AdaptyFlowView` (SwiftUI).
19
-
7. Replace `getPaywallProducts(paywall:)` with `getPaywallProducts(flow:)`.
20
-
8. Update `AdaptyUICustomVideoAsset.player` to use `AVPlayer` instead of `AVQueuePlayer`.
21
-
9. Update `AdaptyUIResolvedFontAsset` usage if you access font properties directly.
-**`Adapty.getPaywallProductsWithoutDeterminingOffer(paywall:)`** — removed. All products now include offer information, so the separate eligibility pass is no longer needed.
31
+
-**`AdaptyPaywallProductWithoutDeterminingOffer`** — removed. Callbacks that previously passed this type (such as `didSelectProduct`) now pass `AdaptyPaywallProduct`.
22
32
23
-
## Replace getPaywall with getFlow
33
+
## Fetching paywalls
24
34
25
-
Replace `Adapty.getPaywall()` with `Adapty.getFlow()`. The returned type changes from `AdaptyPaywall` to `AdaptyFlow`. The `locale` parameter has moved from the fetch call to `AdaptyUI.getFlowConfiguration(forFlow:locale:)` — see the next section.
35
+
### Adapty.getPaywall → Adapty.getFlow
36
+
37
+
The returned type changes from `AdaptyPaywall` to `AdaptyFlow`. The `locale` parameter has moved out of the fetch call — see the next section.
26
38
27
39
```diff showLineNumbers
28
40
- let paywall = try await Adapty.getPaywall(
@@ -32,16 +44,16 @@ Replace `Adapty.getPaywall()` with `Adapty.getFlow()`. The returned type changes
32
44
+ let flow = try await Adapty.getFlow(placementId: "YOUR_PLACEMENT_ID")
33
45
```
34
46
35
-
##Replace getPaywallConfiguration with getFlowConfiguration
Replace `AdaptyUI.getPaywallConfiguration(forPaywall:)` with `AdaptyUI.getFlowConfiguration(forFlow:)`. The method now takes an `AdaptyFlow`object instead of `AdaptyPaywall`. Locale handling now lives here — pass it via the `locale:` parameter:
49
+
The method now takes an `AdaptyFlow`and accepts the `locale:` parameter:
38
50
39
51
```diff showLineNumbers
40
52
- let paywallConfiguration = try await AdaptyUI.getPaywallConfiguration(forPaywall: paywall)
41
53
+ let flowConfiguration = try await AdaptyUI.getFlowConfiguration(forFlow: flow)
42
54
```
43
55
44
-
If you previously passed `locale:` to `getPaywall`, pass it to `getFlowConfiguration` instead:
56
+
If you previously passed `locale:` to `getPaywall`, pass it here instead:
45
57
46
58
```diff showLineNumbers
47
59
- let paywall = try await Adapty.getPaywall(placementId: "main", locale: "fr")
@@ -50,9 +62,20 @@ If you previously passed `locale:` to `getPaywall`, pass it to `getFlowConfigura
50
62
+ let flowConfiguration = try await AdaptyUI.getFlowConfiguration(forFlow: flow, locale: "fr")
51
63
```
52
64
53
-
## Replace AdaptyPaywallController with AdaptyFlowController (UIKit)
Rename the delegate protocol and update all method signatures. Note that `didSelectProduct` now receives `AdaptyPaywallProduct` instead of `AdaptyPaywallProductWithoutDeterminingOffer` — products always include offer information in SDK 4.0 (beta).
93
+
Rename the protocol and update every method signature. Note that `didSelectProduct` now receives `AdaptyPaywallProduct` instead of the removed `AdaptyPaywallProductWithoutDeterminingOffer`.
71
94
72
95
```diff showLineNumbers
73
96
- class YourClass: AdaptyPaywallControllerDelegate {
@@ -145,9 +168,11 @@ Rename the delegate protocol and update all method signatures. Note that `didSel
145
168
}
146
169
```
147
170
148
-
## Replace SwiftUI .paywall() with .flow()
171
+
## SwiftUI
172
+
173
+
### .paywall() modifier → .flow()
149
174
150
-
Rename the modifier from `.paywall()` to `.flow()`and update the configuration parameter name from `paywallConfiguration` to `flowConfiguration`:
175
+
Rename the modifier and update the configuration parameter name:
151
176
152
177
```diff showLineNumbers
153
178
@State var flowPresented = false // rename freely — the variable name is your choice
@@ -167,9 +192,9 @@ Rename the modifier from `.paywall()` to `.flow()` and update the configuration
167
192
}
168
193
```
169
194
170
-
##Replace AdaptyPaywallView with AdaptyFlowView (SwiftUI)
195
+
### AdaptyPaywallView → AdaptyFlowView
171
196
172
-
If you use `AdaptyPaywallView` directly in your SwiftUI code, rename it to `AdaptyFlowView`, update the configuration parameter, and update any `didSelectProduct` closure — it now receives `AdaptyPaywallProduct` instead of `AdaptyPaywallProductWithoutDeterminingOffer`:
197
+
Rename the view, update the configuration parameter, and update any `didSelectProduct` closure — it now receives `AdaptyPaywallProduct` instead of the removed`AdaptyPaywallProductWithoutDeterminingOffer`:
173
198
174
199
```diff showLineNumbers
175
200
- AdaptyPaywallView(
@@ -185,42 +210,22 @@ If you use `AdaptyPaywallView` directly in your SwiftUI code, rename it to `Adap
185
210
)
186
211
```
187
212
188
-
## Update getPaywallProducts call sites
213
+
## AdaptyUI custom assets
189
214
190
-
In v4, `getPaywallProducts` has two overloads — a new `flow:` overload, and the existing `paywall:` overload (which now takes `AdaptyFlowPaywall` instead of `AdaptyPaywall`). Pick the form that matches what your code holds:
215
+
### AdaptyUICustomVideoAsset.player
191
216
192
-
If your code holds an `AdaptyFlow` (the new placement type returned by `Adapty.getFlow`):
193
-
194
-
```diff showLineNumbers
195
-
- let products = try await Adapty.getPaywallProducts(paywall: paywall)
196
-
+ let products = try await Adapty.getPaywallProducts(flow: flow)
197
-
```
198
-
199
-
If your code still works with a single paywall (now `AdaptyFlowPaywall`), keep the `paywall:` label — only the type changes:
The `getPaywallProductsWithoutDeterminingOffer` method has been removed. All products now include offer information directly, so a separate eligibility-checking pass is no longer needed.
207
-
208
-
## Update AdaptyUICustomVideoAsset.player
209
-
210
-
If you use custom video assets, replace `AVQueuePlayer` with `AVPlayer` when constructing the `.player(...)` case:
217
+
If you use custom video assets, replace `AVQueuePlayer` with `AVPlayer`:
211
218
212
219
```diff showLineNumbers
213
220
- case player(item: AVPlayerItem, player: AVQueuePlayer, preview: AdaptyUICustomImageAsset?)
214
221
+ case player(item: AVPlayerItem, player: AVPlayer, preview: AdaptyUICustomImageAsset?)
215
222
```
216
223
217
-
##Update AdaptyUIResolvedFontAsset
224
+
###AdaptyUIResolvedFontAsset
218
225
219
226
`AdaptyUIResolvedFontAsset` is no longer a typealias for `UIFont`. It is now a struct. If you access the underlying font directly, use the `.font` property:
220
227
221
228
```diff showLineNumbers
222
229
- let uiFont: UIFont = fontAsset
223
230
+ let uiFont: UIFont = fontAsset.font
224
231
```
225
-
226
-
The struct also exposes `defaultColor`, `defaultLetterSpacing`, and `defaultLineHeight` for advanced typography control.
0 commit comments