Swift UI - Errors implementing example project

  • 17 November 2021
  • 1 reply

Badge +5

When attempting to implement the PaywallView of the example SwiftUI project in my own project targeting iOS 15.0 I am receiving 2 errors.


Referencing initializer 'init(_:content:)' on 'ForEach' requires that 'Purchases.Package' conform to 'Identifiable'

ForEach(offering?.availablePackages ?? []) { package in
PackageCellView(package: package) { (package) in

/// - Set 'isPurchasing' state to `true`
isPurchasing = true

/// - Purchase a package
Purchases.shared.purchase(package: package) { (transaction, info, error, userCancelled) in

/// - Set 'isPurchasing' state to `false`
isPurchasing = false

/// - If the user didn't cancel and there wasn't an error with the purchase, close the paywall
if !userCancelled, error == nil {
isPresented = false


Value of type 'Purchases.Package' has no member 'terms'

Text(package.terms(for: package))


Any thoughts on what I am doing wrong to generate these errors?


Best answer by cody 19 November 2021, 18:01

View original

1 reply

Userlevel 6
Badge +8

Hey @Sam Petherbridge!

It looks like you might be missing an extension file from the sample apps:

The package terms method as well as the Package conformance to Identifiable is located in that file for the purposes of the sample app.

Let me know if you have any questions!