Utility

  • BJNObservable is a generic type that generates a callback when its value is changed. It can be used to listen in on changes to a specific value, but not to update the value itself. BJNObservable is read-only, for write capabilities, see BJNMutableObservable

    Monitor any change to the value as:

    clientMuteState.onChange {
        print("the client is now \(clientMuteState.value ? "muted" : "unmuted")")
    }
    
    See more
  • BJNMutableObservable is a BJNObservable that allows its value to be changed.

    To modify a BJNMutableObservable‘s value,

    mutableObservableVar.value = true
    

    As a subclass of BJNObservable, you can still listen in on value changes.

    mutableObservableVar.onChange {
        print("value changed to ", mutableObservableVar.value)
    }
    
    See more