Skip to content

Commit 6346dc9

Browse files
committed
Merge branch 'ADP-5877-NEW' into develop
2 parents 733d5b0 + b2bc426 commit 6346dc9

1 file changed

Lines changed: 25 additions & 33 deletions

File tree

src/content/docs/ios/ios-present-paywalls.mdx

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -108,46 +108,38 @@ AdaptyFlowView(
108108

109109
## Present paywalls and flows in UIKit
110110

111-
For UIKit, use `AdaptyUI.flowController(with:delegate:)` to get an `AdaptyFlowController`, then present it like any view controller:
111+
In order to display the paywall or flow on the device screen, do the following:
112112

113-
```swift showLineNumbers title="Swift"
114-
import Adapty
115-
import AdaptyUI
116-
import UIKit
113+
1. Initialize the visual flow you want to display by using the `AdaptyUI.flowController(with:delegate:)` method:
117114

118-
let flowController = try AdaptyUI.flowController(
119-
with: <AdaptyUI.FlowConfiguration>,
120-
delegate: <AdaptyFlowControllerDelegate>
121-
)
122-
present(flowController, animated: true)
123-
```
115+
```swift showLineNumbers title="Swift"
116+
import Adapty
117+
import AdaptyUI
124118

125-
Implement `AdaptyFlowControllerDelegate` to respond to events:
119+
let visualFlow = try AdaptyUI.flowController(
120+
with: <AdaptyUI.FlowConfiguration>,
121+
delegate: <AdaptyFlowControllerDelegate>
122+
)
123+
```
126124

127-
```swift showLineNumbers title="Swift"
128-
extension YourViewController: AdaptyFlowControllerDelegate {
129-
func flowController(_ controller: AdaptyFlowController,
130-
didFailPurchase product: AdaptyPaywallProduct,
131-
error: AdaptyError) {
132-
// Handle purchase failure
133-
}
125+
Request parameters:
134126

135-
func flowController(_ controller: AdaptyFlowController,
136-
didFinishRestoreWith profile: AdaptyProfile) {
137-
// Handle successful restore
138-
}
127+
| Parameter | Presence | Description |
128+
| :----------------------- | :------- | :---------- |
129+
| **flowConfiguration** | required | An `AdaptyUI.FlowConfiguration` object containing visual details of the paywall or flow. Use the `AdaptyUI.getFlowConfiguration(forFlow:)` method. Refer to [Get paywalls and flows](get-pb-paywalls) topic for more details. |
130+
| **delegate** | required | An `AdaptyFlowControllerDelegate` to listen to paywall and flow events. Refer to [Handle paywall & flow events](ios-handling-events) topic for more details. |
139131

140-
func flowController(_ controller: AdaptyFlowController,
141-
didFailRestoreWith error: AdaptyError) {
142-
// Handle restore failure
143-
}
132+
Returns:
144133

145-
func flowController(_ controller: AdaptyFlowController,
146-
didFailRenderingWith error: AdaptyUIError) {
147-
controller.dismiss(animated: true)
148-
}
149-
}
150-
```
134+
| Object | Description |
135+
| :---------------------- | :------------------------------------------------------- |
136+
| **AdaptyFlowController** | An object representing the requested paywall or flow screen. |
137+
138+
2. After the object has been successfully created, you can display it on the screen of the device:
139+
140+
```swift showLineNumbers title="Swift"
141+
present(visualFlow, animated: true)
142+
```
151143

152144
:::tip
153145

0 commit comments

Comments
 (0)