Skip to main content

RevenueCat SDK 4.0.0-beta.1 is out šŸŽ‰

Hey all, some of you might know weā€™ve been hard at work migrating ourĀ mixed-language Purchases.framework to Swift. Well, we did it, and weā€™re excited to share it with you!

For context, here were our goals of the migration:

  • šŸ¦¶ Lowers our overall footprint for modules.

  • šŸ—£ļø Unifies the language used for the entire SDK.

  • šŸš¤ Faster feature development, bug fixes on old logic, and integration through simplified SDK, CI, and testing infrastructure.

  • šŸ Improve consistency among our API calls, classes, properties, etc.

  • :dollar: Enable us to implement StoreKit2 changes easier.

  • šŸ§‘ā€šŸ« Easier onboarding for new members (internal and external).

You can find a more detailed breakdown of the motivations and our actual migration plan in our SwiftMigration.md.

We havenā€™t added any new features (yet), but we did update our API to be more idiomatic to Swift, fixed a few tiny bugs, and improved the safety of our API through fixing various nullability mismatches.

Weā€™re planning on adding StoreKit2 improvements before officially shipping, so stay tuned for those additions.Ā 

How can you help?

You can update to this beta and report your experience to us! Weā€™re looking for any and all feedback, suggestions, and comments šŸ˜„

We feel really confident in our migrated SDK, but having you try it out and tell us itā€™s still performing how you expect it - even if everything is great, is really helpful to us.

Changes:

We tried as hard as we could to retain the same API. Ironically, our ObjC interfaces are nearly exactly the same, the majority of our API changes were naming updates for Swift. There were some required changes (outlined in our API Changes doc), and the biggest being:

Renaming `Purchases` module to `RevenueCat` šŸ˜»

How to install the beta:

We launched a new pod:Ā 

pod 'RevenueCat', '4.0.0-beta.1'

You can also use Carthage, and Swift Package Manager. For SPM, youā€™ll also want to point to the version `4.0.0-beta.1`

Make sure any imports of `Purchases` are switched to: `RevenueCat`.

Anticipated future updates before shipping V4:

  • šŸ” Adding a script that will help migrate your code for changed API.

  • šŸŖ StoreKit2 support.

  • šŸ§± ObjC/Swift block naming convention: changing all references of ā€œcompletionBlockā€ to ā€œcompletionā€ to be more consistent.


Ā 

found a new wierd issue, in beta.7 if you have a current offering without any package, you can see it by calling getOfferings, but not in rc.2 anymore you get nothing, and itā€™s not listed in ā€˜allā€™ object as it was before


I found a way, still not sure that the best :Ā https://github.com/riderx/capacitor-purchases/blob/015b69851457671b221e90fcd502b1bc0472c4e9/ios/Plugin/CapacitorPurchasesPlugin.swift#L83


Hello, i have made a plugin for capacitor apps ( new cordova) using the V4 and it was working super well in beta.7 i just try to upgrade to rc-2 but gotĀ some issue i cannot resolve in StoreProductDiscount.

I made a swift extension to convert swift object to JSON but witht the rc-2 iā€™m unable to get :

-Ā Ā numberOfPeriods
-Ā priceLocale.currencyCode
-Ā priceLocale.currencySymbol
See below my code:

@objc public extension StoreProductDiscount {

Ā  Ā  var localizedPrice: String {

Ā  Ā  Ā  Ā  let formatter = NumberFormatter()

Ā  Ā  Ā  Ā  formatter.numberStyle = .currency

Ā  Ā  Ā  Ā  formatter.locale = priceLocale

Ā  Ā  Ā  Ā  return formatter.string(from: price)!

Ā  Ā  }

Ā  Ā  @available(iOS 12.2, *)

Ā  Ā  func toJson() -> gString: Any] {

Ā  Ā  Ā  Ā  return  

Ā  Ā  Ā  Ā  Ā  Ā  "identifier": offerIdentifier as Any,

Ā  Ā  Ā  Ā  Ā  Ā  "type": type.rawValue,

Ā  Ā  Ā  Ā  Ā  Ā  "price": price,

Ā  Ā  Ā  Ā  Ā  Ā  "localizedPrice": localizedPrice,

Ā  Ā  Ā  Ā  Ā  Ā  "currencySymbol": priceLocale.currencySymbol as Any,

Ā  Ā  Ā  Ā  Ā  Ā  "currencyCode": priceLocale.currencyCode as Any,

Ā  Ā  Ā  Ā  Ā  Ā  "paymentMode": paymentMode.rawValue,

Ā  Ā  Ā  Ā  Ā  Ā  "numberOfPeriods": numberOfPeriods,

Ā  Ā  Ā  Ā  Ā  Ā  "subscriptionPeriod": subscriptionPeriod.toJson(),

Ā  Ā  Ā  Ā  ]

Ā  Ā  }

}
All look good otherwise, thanks for the work !


Reply