Skip to content

Commit

Permalink
Rename PaywallView(event:) to PaywallView(placement:)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuftor committed Jan 15, 2025
1 parent 492b396 commit c7169c2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

The changelog for `SuperwallKit`. Also see the [releases](https://github.com/superwall/Superwall-iOS/releases) on GitHub.

## 4.0.0-beta.3

### Breaking Changes

- Renames `PaywallView(event:)` to `PaywallView(placement:)`.

## 4.0.0-beta.2

### Fixes

- Fixes an issue to do with audience filters.
- Readds unavailable functions from v3 to make the upgrade path smoother.
- Re-adds unavailable functions from v3 to make the upgrade path smoother.

## 4.0.0-beta.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func toPassableValue(from anyValue: Any) -> PassableValue {
if let number = anyValue as? NSNumber {
// Check if it is a boolean
if CFGetTypeID(number) == CFBooleanGetTypeID() {
return .bool(number.boolValue)
return .bool(number.boolValue)
}
// If not a boolean, let the switch handle the rest
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI

/// A SwiftUI paywall view that you can embed into your app.
///
/// This uses ``Superwall/getPaywall(forEvent:params:paywallOverrides:delegate:)`` under the hood.
/// This uses ``Superwall/getPaywall(forPlacement:params:paywallOverrides:delegate:)`` under the hood.
///
/// - Warning: You're responsible for the deallocation of this view. If you have a `PaywallView` presented somewhere
/// and you try to present the same `PaywallView` elsewhere, you will get a crash.
Expand All @@ -21,10 +21,10 @@ public struct PaywallView<
@State private var hasLoaded = false
@Environment(\.presentationMode) private var presentationMode

/// The name of the event, as you have defined on the Superwall dashboard.
private let event: String
/// The name of the placement, as you have defined on the Superwall dashboard.
private let placement: String

/// Optional parameters you'd like to pass with your event. Defaults to `nil`.
/// Optional parameters you'd like to pass with your placement. Defaults to `nil`.
///
/// These can be referenced within the rules
/// of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any
Expand Down Expand Up @@ -60,11 +60,11 @@ public struct PaywallView<

/// A SwiftUI paywall view that you can embed into your app.
///
/// This uses ``Superwall/getPaywall(forEvent:params:paywallOverrides:delegate:)`` under the hood.
/// This uses ``Superwall/getPaywall(forPlacement:params:paywallOverrides:delegate:)`` under the hood.
///
/// - Parameters:
/// - event: The name of the event, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your event. These can be referenced within the rules
/// - placement: The name of the placement, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your placement. These can be referenced within the rules
/// of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any
/// JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will
/// be dropped.
Expand All @@ -84,15 +84,15 @@ public struct PaywallView<
/// - Warning: You're responsible for the deallocation of this view. If you have a `PaywallView` presented somewhere
/// and you try to present the same `PaywallView` elsewhere, you will get a crash.
public init(
event: String,
placement: String,
params: [String: Any]? = nil,
paywallOverrides: PaywallOverrides? = nil,
onRequestDismiss: ((PaywallInfo, PaywallResult) -> Void)? = nil,
onSkippedView: ((PaywallSkippedReason) -> OnSkippedView)? = nil,
onErrorView: ((Error) -> OnErrorView)? = nil,
feature: (() -> Void)? = nil
) {
self.event = event
self.placement = placement
self.params = params
self.paywallOverrides = paywallOverrides
self.onRequestDismiss = onRequestDismiss
Expand Down Expand Up @@ -140,7 +140,7 @@ public struct PaywallView<
hasLoaded = true
Task {
await manager.getPaywall(
forPlacement: event,
forPlacement: placement,
params: params,
paywallOverrides: paywallOverrides
)
Expand All @@ -154,10 +154,10 @@ public struct PaywallView<
extension PaywallView where OnSkippedView == Never, OnErrorView == Never {
/// A SwiftUI paywall view that you can embed into your app.
///
/// This uses ``Superwall/getPaywall(forEvent:params:paywallOverrides:delegate:)`` under the hood.
/// This uses ``Superwall/getPaywall(forPlacement:params:paywallOverrides:delegate:)`` under the hood.
///
/// - Parameters:
/// - event: The name of the event, as you have defined on the Superwall dashboard.
/// - placement: The name of the placement, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your event. These can be referenced within the rules
/// of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any
/// JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will
Expand All @@ -174,13 +174,13 @@ extension PaywallView where OnSkippedView == Never, OnErrorView == Never {
/// - Warning: You're responsible for the deallocation of this view. If you have a `PaywallView` presented somewhere
/// and you try to present the same `PaywallView` elsewhere, you will get a crash.
public init(
event: String,
placement: String,
params: [String: Any]? = nil,
paywallOverrides: PaywallOverrides? = nil,
onRequestDismiss: ((PaywallInfo, PaywallResult) -> Void)? = nil,
feature: (() -> Void)? = nil
) {
self.event = event
self.placement = placement
self.params = params
self.paywallOverrides = paywallOverrides
self.onErrorView = nil
Expand All @@ -194,11 +194,11 @@ extension PaywallView where OnSkippedView == Never, OnErrorView == Never {
extension PaywallView where OnSkippedView == Never {
/// A SwiftUI paywall view that you can embed into your app.
///
/// This uses ``Superwall/getPaywall(forEvent:params:paywallOverrides:delegate:)`` under the hood.
/// This uses ``Superwall/getPaywall(forPlacement:params:paywallOverrides:delegate:)`` under the hood.
///
/// - Parameters:
/// - event: The name of the event, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your event. These can be referenced within the rules
/// - placement: The name of the placement, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your placement. These can be referenced within the rules
/// of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any
/// JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will
/// be dropped.
Expand All @@ -216,14 +216,14 @@ extension PaywallView where OnSkippedView == Never {
/// - Warning: You're responsible for the deallocation of this view. If you have a `PaywallView` presented somewhere
/// and you try to present the same `PaywallView` elsewhere, you will get a crash.
public init(
event: String,
placement: String,
params: [String: Any]? = nil,
paywallOverrides: PaywallOverrides? = nil,
onRequestDismiss: ((PaywallInfo, PaywallResult) -> Void)? = nil,
onErrorView: @escaping (Error) -> OnErrorView,
feature: (() -> Void)? = nil
) {
self.event = event
self.placement = placement
self.params = params
self.paywallOverrides = paywallOverrides
self.onRequestDismiss = onRequestDismiss
Expand All @@ -237,11 +237,11 @@ extension PaywallView where OnSkippedView == Never {
extension PaywallView where OnErrorView == Never {
/// A SwiftUI paywall view that you can embed into your app.
///
/// This uses ``Superwall/getPaywall(forEvent:params:paywallOverrides:delegate:)`` under the hood.
/// This uses ``Superwall/getPaywall(forPlacement:params:paywallOverrides:delegate:)`` under the hood.
///
/// - Parameters:
/// - event: The name of the event, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your event. These can be referenced within the rules
/// - placement: The name of the placement, as you have defined on the Superwall dashboard.
/// - params: Optional parameters you'd like to pass with your placement. These can be referenced within the rules
/// of your campaign. Keys beginning with `$` are reserved for Superwall and will be dropped. Values can be any
/// JSON encodable value, URLs or Dates. Arrays and dictionaries as values are not supported at this time, and will
/// be dropped.
Expand All @@ -261,14 +261,14 @@ extension PaywallView where OnErrorView == Never {
/// - Warning: You're responsible for the deallocation of this view. If you have a `PaywallView` presented somewhere
/// and you try to present the same `PaywallView` elsewhere, you will get a crash.
public init(
event: String,
placement: String,
params: [String: Any]? = nil,
paywallOverrides: PaywallOverrides? = nil,
onRequestDismiss: ((PaywallInfo, PaywallResult) -> Void)? = nil,
onSkippedView: @escaping (PaywallSkippedReason) -> OnSkippedView,
feature: (() -> Void)? = nil
) {
self.event = event
self.placement = placement
self.params = params
self.paywallOverrides = paywallOverrides
self.onErrorView = nil
Expand Down

0 comments on commit c7169c2

Please sign in to comment.