// Generated by Khrysalis Swift converter - this file will be overwritten.
// File: observables/StandardObservableProperty.kt
// Package: com.lightningkite.butterfly.observables
import RxSwift
import Foundation

public class StandardObservableProperty<T> : MutableObservableProperty<T> {
    public var underlyingValue: T
    private var _onChange: Subject<T>
    override public var onChange: Subject<T> { get { return self._onChange } set(value) { self._onChange = value } }
    public init(underlyingValue: T, onChange: Subject<T> = PublishSubject()) {
        self.underlyingValue = underlyingValue
        self._onChange = onChange
        super.init()
        //Necessary properties should be initialized now
    }
    
    override public var value: T {
        get { return self.underlyingValue }
        set(value) {
            self.underlyingValue = value
            self.onChange.onNext(value)
        }
    }
    
    override public func update() -> Void {
        self.onChange.onNext(self.value)
    }
}


