State

class State<Value> : Causality.AnyState<Value> & Hashable where Value : Equatable

Declare states with typed values as labels to be used for set() and subscribe() calls.

Example:

static let SomeState = Causality.State<Int>(label: "Some State")

This declares SomeState as an state that will pass an Int to subscribers whenever the value changes.

  • A name assigned to the state. This is not a key parameter and does not need to be unique.

    Declaration

    Swift

    public let label: String
  • Declaration

    Swift

    public static func == (lhs: Causality.State<Value>, rhs: Causality.State<Value>) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)