Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions content/docs/ios/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ title: "Changelog"
description: "Release notes for the Superwall iOS SDK"
---

## 4.15.1

### Enhancements

- Adds an `onCustomCallback` parameter to `getPaywall`.
- `SuperwallOptions.localResources` now accepts UIImage's from xcasset files, e.g. `UIImage(named: "my-image")`.
- Exposes abandoned transaction product params in audience filters.

### Fixes

- Sanitizes email user attribute.

## 4.15.0

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion content/docs/ios/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ If you have feedback on any of our docs, please leave a rating and message at th
If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/superwall-ios/issues).

<SdkLatestVersion
version="4.15.0"
version="4.15.1"
repoUrl="https://github.com/superwall/Superwall-iOS"
/>
6 changes: 3 additions & 3 deletions content/docs/ios/sdk-reference/SuperwallOptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class SuperwallOptions: NSObject {
public var localeIdentifier: String?
public var shouldBypassAppTransactionCheck: Bool
public var testModeBehavior: TestModeBehavior
public var localResources: [String: URL]
public var localResources: [String: AssetResource]
}
```

Expand Down Expand Up @@ -73,9 +73,9 @@ public final class SuperwallOptions: NSObject {
default: ".automatic",
},
localResources: {
type: "[String: URL]",
type: "[String: AssetResource]",
description:
"A dictionary mapping resource IDs to local file URLs. See [`localResources`](/ios/sdk-reference/localResources) for the property schema and the [Local Resources guide](/ios/guides/local-resources) for setup details.",
"A dictionary mapping resource IDs to local file URLs or asset catalog images. See [`localResources`](/ios/sdk-reference/localResources) for the property schema and the [Local Resources guide](/ios/guides/local-resources) for setup details.",
default: "[:]",
},
}}
Expand Down
26 changes: 22 additions & 4 deletions content/docs/ios/sdk-reference/advanced/getPaywall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public func getPaywall(
forPlacement placement: String,
params: [String: Any]? = nil,
paywallOverrides: PaywallOverrides? = nil,
delegate: PaywallViewControllerDelegate
delegate: PaywallViewControllerDelegate,
onCustomCallback: ((CustomCallback) async -> CustomCallbackResult)? = nil
) async throws -> PaywallViewController

// Completion handler version
Expand All @@ -31,6 +32,7 @@ public func getPaywall(
params: [String: Any]? = nil,
paywallOverrides: PaywallOverrides? = nil,
delegate: PaywallViewControllerDelegate,
onCustomCallback: ((CustomCallback) async -> CustomCallbackResult)? = nil,
completion: @escaping (PaywallViewController?, PaywallSkippedReason?, Error?) -> Void
)
```
Expand Down Expand Up @@ -58,6 +60,11 @@ public func getPaywall(
description: "A delegate to handle user interactions with the retrieved PaywallViewController.",
required: true,
},
onCustomCallback: {
type: "((CustomCallback) async -> CustomCallbackResult)?",
description: "Optional async handler called when the paywall requests a custom callback. Return a `CustomCallbackResult` to report success or failure back to the paywall. Available in version 4.15.1+.",
default: "nil",
},
completion: {
type: "@escaping (PaywallViewController?, PaywallSkippedReason?, Error?) -> Void",
description: "Completion block for the callback version.",
Expand All @@ -79,7 +86,15 @@ Task {
let paywallViewController = try await Superwall.shared.getPaywall(
forPlacement: "premium_feature",
params: ["source": "settings"],
delegate: self
delegate: self,
onCustomCallback: { callback in
switch callback.name {
case "validate_email":
return .success(data: ["validated": true])
default:
return .failure()
}
}
)

present(paywallViewController, animated: true)
Expand All @@ -95,7 +110,10 @@ Using completion handler:
```swift
Superwall.shared.getPaywall(
forPlacement: "premium_feature",
delegate: self
delegate: self,
onCustomCallback: { callback in
.success(data: ["callback": callback.name])
}
) { paywall, skippedReason, error in
if let paywall = paywall {
present(paywall, animated: true)
Expand All @@ -105,4 +123,4 @@ Superwall.shared.getPaywall(
print("Error: \(error)")
}
}
```
```
2 changes: 1 addition & 1 deletion content/docs/ios/sdk-reference/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ If you have feedback on any of our docs, please leave a rating and message at th
If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/superwall-ios/issues).

<SdkLatestVersion
version="4.15.0"
version="4.15.1"
repoUrl="https://github.com/superwall/Superwall-iOS"
/>
14 changes: 5 additions & 9 deletions content/docs/ios/sdk-reference/localResources.mdx
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
---
title: "localResources"
description: "Register local file URLs so paywalls can load bundled media by resource ID."
description: "Register local resources so paywalls can load bundled media by resource ID."
---

<Info>
Available in iOS SDK `4.13.0+`.
</Info>

## Purpose

`localResources` maps resource IDs to local file URLs so paywalls can request bundled media with `swlocal://resource-id` instead of downloading them from a remote URL.
`localResources` maps resource IDs to local resources so paywalls can request bundled media with `swlocal://resource-id` instead of downloading them from a remote URL. Values can be file `URL`s or `UIImage`s from asset catalogs.

## Signature

```swift
public var localResources: [String: URL]
public var localResources: [String: AssetResource]
```

## Schema
Expand All @@ -27,8 +23,8 @@ public var localResources: [String: URL]
required: true,
},
value: {
type: "URL",
description: "A local file URL from your app bundle or sandbox.",
type: "AssetResource",
description: "A local file `URL` from your app bundle or sandbox, or a `UIImage` from an asset catalog.",
required: true,
},
}}
Expand Down
1 change: 1 addition & 0 deletions content/shared/local-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ On iOS, local resources are configured on `SuperwallOptions.localResources` befo
let options = SuperwallOptions()
options.localResources = [
"hero-image": Bundle.main.url(forResource: "hero", withExtension: "png")!,
"logo": UIImage(named: "Logo")!,
"onboarding-video": Bundle.main.url(forResource: "welcome", withExtension: "mp4")!
]

Expand Down
Loading