Created
July 21, 2019 22:34
-
-
Save chrislonge/0c67979caa0952e3857e4b9d2655b543 to your computer and use it in GitHub Desktop.
Template to conform to Hashable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct MyModel: Hashable { | |
let identifier = UUID() | |
func hash(into hasher: inout Hasher) { | |
hasher.combine(identifier) | |
} | |
static func == (lhs: MyModel, rhs: MyModel) -> Bool { | |
return lhs.identifier == rhs.identifier | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment