Question

Updating to RevenueCat pod breaks a couple things


Badge +4

Hi, 

I have an iOS app with RevenueCat already implemented. I recently saw that `Purchases` is being deprecated for `RevenueCat` so I went ahead and updated our Podfile from `pod Purchases` to `pod RevenueCat`.

 

I’m able to convert a lot of the code over to the new SDK, but there are a couple things that are missing.

 

  1. I am no longer able to get the currency symbol (eg. “$”) from this anymore. I used to be able to do something like `pack.storeProduct.priceLocale.currencySymbol` but `priceLocale` is no longer included in the SDK. My current work around is to do something like this: `pack.storeProduct.localizedPriceString.first(where: { !$0.isNumber }).map { String($0) }` which seems much less ideal.
  2. On the `StoreTransaction` object, the old version had a `original` field that allowed me to check whether it was first transaction or if purchases were being transferred over (transaction?.original == nil). However, the new version no longer has this. Is there a way I can see whether this is a fresh purchase?

Really appreciate the help here.

 

Best,
Kevin


2 replies

Badge +3

Hello.

I too am facing the same issue. Was someone able to get the currency symbol?

Badge +4

Hey @Akash ! we ended up going with something that feels really hacky, but hope this helps unblock you:

 

```

extension RevenueCat.StoreProduct {

    var currencySymbol: String? {

        guard let identifier = Locale.availableIdentifiers.first(where: { Locale(identifier: $0).currencyCode == currencyCode }) else { return nil }

        return Locale(identifier: identifier).currencySymbol

    }

}

```

then you can do something like `pack.storeProduct.currencySymbol`

Reply