'Hashable.hashValue' 作为协议要求已弃用;通过实施 'hash(into:)' 使类型 'CarnivalWheel' 符合 'Hashable'

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

似乎无法正确更改 hash(into:)?我尝试的一切都带来了新的错误

如有任何帮助,我们将不胜感激, Swift5

import UIKit
import TTFortuneWheel

class CarnivalWheel: FortuneWheelSliceProtocol, Codable, Hashable {
    static func == (lhs: CarnivalWheel, rhs: CarnivalWheel) -> Bool {
        return ObjectIdentifier(lhs) == ObjectIdentifier(rhs)
    }
    
    var hashValue: Int {
        return ObjectIdentifier(self).hashValue
    }
    
    enum Style: String, Codable, Hashable {
        case blue
        case purple
        case green
        case grey
        case orange
        case yellow
    }
    var style: Style = .blue
    var backgroundColor: UIColor? {
        switch style {
        case .blue: return TTUtils.uiColor(from: 0xdff9fb)
        case .purple: return TTUtils.uiColor(from: 0xa29bfe)
        case .green: return TTUtils.uiColor(from: 0x7bed9f)
        case . grey: return TTUtils.uiColor(from: 0xdfe4ea)
        case .orange: return TTUtils.uiColor(from: 0xffbe76)
        case .yellow: return TTUtils.uiColor(from: 0xf6e58d)
        }
    }
    
    var title: String
    var degree: CGFloat = 0.0
    
    init(title: String) {
        self.title = title
    }
    
    var fontColor: UIColor {
        return UIColor.black
    }
    
    var offsetFromExterior: CGFloat {
        return 10.0
    }
    
    var stroke: StrokeInfo? {
        return StrokeInfo(color: UIColor.white, width: 1.0)
    }
    
    convenience init(title: String, degree: CGFloat) {
        self.init(title: title)
        self.degree = degree
    }
}
func hash(into hasher: inout Hasher) {
        hasher.combine(ObjectIdentifier(self))
    }

将添加一致性。