I am having difficulty in the logic for making a consumable purchase. Basically I am not sure how to proceed with this function:
private var item: Purchases.Package? {
Items.shared.item
}
Purchases.shared.products(["com.item.id"]) { products in
guard let item = products.first else { return }
Purchases.shared.purchaseProduct(item) { transaction, purchaserInfo, error, cancelled in
// enable some stuff in the app
}
}
public class Items: ObservableObject {
public static let shared = Items()
@Published public var item: Purchases.Package?
init() {
Purchases.shared.products(["com.item.id"]) { products in
self.item = products.first
}
}
}
If I try to initialise like above, it complains that it is a SKProduct?
, and cannot be assigned to Purchases.Package?
.