From b4131644e90ba311ea903d8ae2add09e23e15636 Mon Sep 17 00:00:00 2001 From: Syo Ikeda Date: Wed, 25 Nov 2015 00:20:50 +0900 Subject: [PATCH] Refactor NSObject.rex_valueProperty() using associatedProperty() --- Source/Foundation/NSObject.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/Foundation/NSObject.swift b/Source/Foundation/NSObject.swift index d852ed1..6f547d4 100644 --- a/Source/Foundation/NSObject.swift +++ b/Source/Foundation/NSObject.swift @@ -59,10 +59,6 @@ extension NSObject { /// N.B. Ensure that `self` isn't strongly captured by `initial` or `setter`, otherwise this /// will create a retain cycle causing `self` to never dealloc. public func rex_valueProperty(key: UnsafePointer<()>, _ initial: () -> T, _ setter: T -> ()) -> MutableProperty { - return associatedObject(self, key: key) { - let property = MutableProperty(initial()) - property.producer.start(Observer(next: setter)) - return property - } + return associatedProperty(self, key: key, initial: initial, setter: setter) } }