Skip to content

Instantly share code, notes, and snippets.

@loucimj
Created August 7, 2017 15:12
Show Gist options
  • Save loucimj/ebdafc0387bd12c037e7127e8a9b4ddf to your computer and use it in GitHub Desktop.
Save loucimj/ebdafc0387bd12c037e7127e8a9b4ddf to your computer and use it in GitHub Desktop.
Customizing structs to use Diffable
extension TicketShort: Diffable {
var diffIdentifier: String {
return id
}
static func ==(lhs: TicketShort, rhs: TicketShort) -> Bool {
return lhs.id == rhs.id
}
func diffable() -> ListDiffable {
return DiffableBox(value: self, identifier: self.diffIdentifier as NSObjectProtocol, equal: ==)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment