Swift:';Hashable.hashValue';作为协议要求不推荐使用
我在Swift项目中遇到了这个问题: “Hashable.hashValue”作为协议要求不推荐使用;通过改为实现“hash(into:)”将类型“ActiveType”与“Hashable”一致 我试图实现这种方法,但没有成功Swift:';Hashable.hashValue';作为协议要求不推荐使用,swift,swift5,hashable,Swift,Swift5,Hashable,我在Swift项目中遇到了这个问题: “Hashable.hashValue”作为协议要求不推荐使用;通过改为实现“hash(into:)”将类型“ActiveType”与“Hashable”一致 我试图实现这种方法,但没有成功 删除您的回调属性并添加success属性var success:Bool。顺便说一句,hashValue已被弃用func散列(into-hasher:inout-hasher){hasher.combine(product.productIdentifier)谢谢!此f
删除您的
回调
属性并添加success
属性var success:Bool
。顺便说一句,hashValue已被弃用func散列(into-hasher:inout-hasher){hasher.combine(product.productIdentifier)
谢谢!此func散列(into-hasher:inout-hasher){hasher.combine(product.productIdentifier)}
修复了该问题。
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
}
}