         ObservablePropertySubscriptionReference<ValueType>
     internal var subscriptions = [ObservablePropertySubscriptionReferenceType : (ValueType) -> ()]()
     private var subscriptionToken: Int = 0
+    private var retainReference: ObservableProperty<ValueType>?
     public var value: ValueType {
         didSet {
             subscriptions.forEach { $0.value(value) }

    @discardableResult
    public func subscribe(_ function: @escaping (ValueType) -> Void) -> SubscriptionReferenceType? {
        defer { subscriptionToken += 1 }
        defer { function(value) }
        let reference = ObservablePropertySubscriptionReferenceType(key: String(subscriptionToken),
                                                            stream: self)
        subscriptions.updateValue(function, forKey: reference)


    internal func unsubscribe(reference: ObservablePropertySubscriptionReferenceType) {
        subscriptions.removeValue(forKey: reference)
        if subscriptions.count == 0 {
            retainReference = nil
        }
    }
}
