From 26b38e3444ef5d47f0c8b49eba439d15e2c63fb5 Mon Sep 17 00:00:00 2001 From: Krunoslav Zaher Date: Thu, 24 Dec 2015 19:50:22 +0100 Subject: [PATCH] Transforms strong into weak reference for `rx_notification` wrapper. --- RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift b/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift index ba6f006b..7ffebd9a 100644 --- a/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift +++ b/RxCocoa/Common/Observables/NSNotificationCenter+Rx.swift @@ -21,7 +21,7 @@ extension NSNotificationCenter { */ @warn_unused_result(message="http://git.io/rxs.uo") public func rx_notification(name: String, object: AnyObject? = nil) -> Observable { - return Observable.create { observer in + return Observable.create { [weak object] observer in let nsObserver = self.addObserverForName(name, object: object, queue: nil) { notification in observer.on(.Next(notification)) }