Skip to content

Instantly share code, notes, and snippets.

@endavid
Created February 26, 2020 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endavid/ba7fe7fc132921ef1c0ddb19a52fab8e to your computer and use it in GitHub Desktop.
Save endavid/ba7fe7fc132921ef1c0ddb19a52fab8e to your computer and use it in GitHub Desktop.
#swift equatable example for #medium
class Cheese: Equatable {
static func == (lhs: Cheese, rhs: Cheese) -> Bool {
return lhs.rating == rhs.rating
}
let rating : Int
init(rating: Int) {
self.rating = rating
}
}
/// ...
cheeses.contains(c1) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment