Skip to content

Instantly share code, notes, and snippets.

View sloat's full-sized avatar

Matt Schmidt sloat

View GitHub Profile
struct Observable<T> {
typealias ValueType = T
typealias SubscriptionType = Subscription<T>
var value: ValueType {
didSet {
for subscription in subscriptions {
let event = ValueChangeEvent(oldValue, value)
subscription.notify(event)
}