HIPEventedPropertyOptional

open class HIPEventedPropertyOptional<T: Equatable>: HIPEventSource, HIPEventSourceWithValue

The optional variety of HIPEventedProperty requires an equatable, non-optional value type, but the stored value may be nil. In other words, You instantiate with HIPEventedPropertyOptional<MyType>, and the type of value is MyType?.

See HIPEventSourceWithValue for more methods.

When the value changes, subscribers are only fired if the new value is not == to the old value, unless shouldSkipDuplicates is set to true.

  • Stored value of the property. Whenever this changes, all subscribers are fired unless their associated objects have been deallocated, or the new value is == to the old value and shouldSkipDuplicates is true.

    Declaration

    Swift

    open var value: T?
  • If true (default), subscribers are not fired when value is set if it is not == to the previous value.

    Declaration

    Swift

    open var shouldSkipDuplicates: Bool
  • Declaration

    Swift

    public init(_ initialValue: T?, shouldSkipDuplicates: Bool = true)

    Parameters

    initialValue

    Initial value of the property

    skipDuplicates

    If true (default), subscribers are not fired when value is set if it is not == to the previous value.