Skip to content

Instantly share code, notes, and snippets.

@O-O-wl
Created May 28, 2020 12:24
Show Gist options
  • Save O-O-wl/b8ffa298b7dbc20788e8220b31a0fcfb to your computer and use it in GitHub Desktop.
Save O-O-wl/b8ffa298b7dbc20788e8220b31a0fcfb to your computer and use it in GitHub Desktop.
struct Changes<Wrapped> {
private var version: UInt = 0
var value: Wrapped {
didSet { version += 1 }
}
init(_ value: Wrapped) {
self.value = value
}
}
extension Changes: Equatable {
static func == (lhs: Changes<Wrapped>, rhs: Changes<Wrapped>) -> Bool {
return lhs.version == rhs.version
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment