Skip to content

Instantly share code, notes, and snippets.

@lizixroy
Created September 4, 2016 20:06
Show Gist options
  • Save lizixroy/f8664cf8cfb3334bf97d9b4a747fa8b7 to your computer and use it in GitHub Desktop.
Save lizixroy/f8664cf8cfb3334bf97d9b4a747fa8b7 to your computer and use it in GitHub Desktop.
RxSwift-article-12.swift
struct SubscriptionDisposable<T: SynchronizedUnsubscribeType> : Disposable {
private let _key: T.DisposeKey
private weak var _owner: T?
init(owner: T, key: T.DisposeKey) {
_owner = owner
_key = key
}
func dispose() {
_owner?.synchronizedUnsubscribe(_key)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment