Skip to content

Instantly share code, notes, and snippets.

@DevAndArtist
Created June 24, 2018 16:17
Show Gist options
  • Select an option

  • Save DevAndArtist/d787fdcc11c8844fa505b298932fe2e3 to your computer and use it in GitHub Desktop.

Select an option

Save DevAndArtist/d787fdcc11c8844fa505b298932fe2e3 to your computer and use it in GitHub Desktop.
protocol ValueContainer {
associatedtype Value
var value: Value { get }
init(_ value: Value)
}
extension ValueContainer where Self : Equatable, Value : Equatable {
static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.value == rhs.value
}
}
protocol Cacheable : Equatable {
associatedtype Container : (
ValueContainer & Hashable
) where Container.Value == Self
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment