Skip to content

Instantly share code, notes, and snippets.

@ukitaka
Last active June 27, 2016 12:02
Show Gist options
  • Save ukitaka/1b57957aba6c9dd3be1ac036c45ad972 to your computer and use it in GitHub Desktop.
Save ukitaka/1b57957aba6c9dd3be1ac036c45ad972 to your computer and use it in GitHub Desktop.
SwiftでDDD - Entity用のprotocol
public protocol Entity: Equatable {
associatedtype ID: Equatable
var id: ID { get }
}
public func ==<E: Entity>(lhs: E, rhs: E) -> Bool {
return lhs.id == rhs.id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment