I use to have the following code that worked in Swift 4.2 but is now deprecated in Swift 5:
struct xxx: Hashable {
var hashValue: Int {return uniqueIdentifier}
When I try to use the new hash(into hasher: inout Hasher)
I'm not sure what to do. My uniqueIdentifier starts at 0 and keeps incrementing so it's always unique, no need for anything fancy. But it seams to me that I'm now required to have the following code:
func hash(into hasher: inout Hasher) {
hasher.combine(uniqueIdentifier)
}
Is this true? I don't see why I need to combined my uniqueIdentifier with some seed. Is there a way I can overcome this or I'm I stuck using hasher.combine(uniqueIdentifier)
?