Skip to content

Instantly share code, notes, and snippets.

View michaelcordero's full-sized avatar
🎯
Focusing

Michael Cordero michaelcordero

🎯
Focusing
View GitHub Profile
@dabrahams
dabrahams / AnyComparable.swift
Created December 8, 2016 02:49
Faux Equatable and Comparable Existentials
class AnyEquatableBase {
func isEqual(to other: AnyEquatableBase) -> Bool {
fatalError("overrideMe")
}
}
class AnyEquatableBox<T: Equatable> : AnyEquatableBase {
let value: T
init(_ value: T) { self.value = value }