Created
December 14, 2016 09:29
-
-
Save swhitty/caf49fe341a0264fbb990c28a2f07682 to your computer and use it in GitHub Desktop.
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
struct AnyEquatable: Equatable { | |
let base: Any | |
let isEqual: (_ other: AnyEquatable) -> Bool | |
init<T: Equatable>(_ base: T) { | |
self.base = base | |
self.isEqual = { base == $0.base as? T } | |
} | |
public static func ==(lhs: AnyEquatable, rhs: AnyEquatable) -> Bool { | |
return lhs.isEqual(rhs) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment