0

I'm having this issue in my Swift project:

'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'ActiveType' to 'Hashable' by implementing 'hash(into:)' instead

struct Payment: Hashable {
    let product: SKProduct
    let quantity: Int
    let atomically: Bool
    let applicationUsername: String
    let simulatesAskToBuyInSandbox: Bool
    let callback: (TransactionResult) -> Void

    var hashValue: Int {
        return product.productIdentifier.hashValue
    }

    static func == (lhs: Payment, rhs: Payment) -> Bool {
        return lhs.product.productIdentifier == rhs.product.productIdentifier
    }
}

I tried to implement this approach, but didn't have any success.

Swift Code Screenshot

Leo Dabus
  • 229,809
  • 59
  • 489
  • 571
Alina
  • 9
  • 2
  • Remove your `callback` property and add a `success` property `var success: Bool`. Btw `hashValue` is deprecated `func hash(into hasher: inout Hasher) { hasher.combine(product.productIdentifier) ` – Leo Dabus Jan 16 '20 at 02:16
  • 1
    Thank you! This `func hash(into hasher: inout Hasher) { hasher.combine(product.productIdentifier) }` fixed the issue. – Alina Jan 16 '20 at 22:30

0 Answers0