Created
February 26, 2020 18:04
-
-
Save endavid/ba7fe7fc132921ef1c0ddb19a52fab8e to your computer and use it in GitHub Desktop.
#swift equatable example for #medium
This file contains hidden or 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
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