0001    /**
0002     This is the protocol that the state the store holds must implement.
0003    
0004     To use a custom state type, this protocol must be implemented on that object.
0005    
0006     This is useful if you want to plug in a reactive programming library and use
0007     that for state instead of the built-in ObservableProperty type.
0008    */
0009    public protocol ObservablePropertyType
ObservableProperty.swift:84
extension ObservableProperty: ObservablePropertyType { }
{ 0010 /** 0011 The type of the value that `Self` will hold. 0012 0013 - note: This is inferred from the `value` property implementation. 0014 */ 0015 typealias ValueType
ObservableProperty.swift:20
    var value: ValueType { get set }
Store.swift:39
    mutating func dispatch<Action: ActionType where Action.StateValueType == ObservableState.ValueType>(action: Action)
Store.swift:53
    public mutating func dispatch<Action: ActionType where Action.StateValueType == ObservableState.ValueType>(action: Action) {
0016 0017 /** 0018 The value to be observed and mutated. 0019 */ 0020 var value
Store.swift:54
        state.value = action.reduce(state.value)
Store.swift:54
        state.value = action.reduce(state.value)
: ValueType { get set } 0021 } 0022 0023 /** 0024 A basic implementation of a property whose `value` can be observed 0025 using callbacks. 0026 0027 0028 ```swift 0029 Example: 0030 0031 var property = ObservableProperty(1) 0032 0033 property.subscribe { newValue in 0034 print("newValue: \(newValue)") 0035 } 0036 0037 property.value = 2 0038 0039 // Executing the above code prints: 0040 // "newValue: 2" 0041 ``` 0042 */ 0043 public class ObservableProperty
ObservableProperty.swift:84
extension ObservableProperty: ObservablePropertyType { }
<ValueType
ObservableProperty.swift:47
    public typealias CallbackType = (ValueType -> ())
ObservableProperty.swift:55
    public var value: ValueType {
ObservableProperty.swift:64
    public init(_ value: ValueType) {
> { 0044 /** 0045 The type of the callback to be called when the `value` changes. 0046 */ 0047 public typealias CallbackType
ObservableProperty.swift:49
    private var subscriptions = [CallbackType]()
ObservableProperty.swift:73
    public func subscribe(callback: CallbackType) {
= (ValueType -> ()) 0048 0049 private var subscriptions
ObservableProperty.swift:74
        subscriptions.append(callback)
ObservableProperty.swift:78
        for subscription in subscriptions {
= [CallbackType]() 0050 0051 /** 0052 The `value` stored in this instance. Setting it to a new value will notify 0053 any subscriptions registered through the `subscribe` method. 0054 */ 0055 public var value
ObservableProperty.swift:65
        self.value = value
ObservableProperty.swift:79
            subscription(value)
: ValueType { 0056 didSet { 0057 notifySubscriptions() 0058 } 0059 } 0060 0061 /** 0062 - parameter value: The initial value to store. 0063 */ 0064 public init(_ value: ValueType) { 0065 self.value = value 0066 } 0067 0068 /** 0069 Register a subscriber that will be called with the new value when the `value` changes. 0070 0071 - parameter callback: The function to call when the value changes. 0072 */ 0073 public func subscribe(callback: CallbackType) { 0074 subscriptions.append(callback) 0075 } 0076 0077 private func notifySubscriptions
ObservableProperty.swift:57
            notifySubscriptions()
() { 0078 for subscription in subscriptions { 0079 subscription(value) 0080 } 0081 } 0082 } 0083 0084 extension ObservableProperty: ObservablePropertyType { } 0085