PropertyProtocol

public protocol PropertyProtocol : AnyObject, BindingSource

Represents a property that allows observation of its changes.

Only classes can conform to this protocol, because having a signal for changes over time implies the origin must have a unique identity.

  • The current value of the property.

    Declaration

    Swift

    var value: Value { get }
  • The values producer of the property.

    It produces a signal that sends the property’s current value, followed by all changes over time. It completes when the property has deinitialized, or has no further change.

    Note

    If self is a composed property, the producer would be bound to the lifetime of its sources.

    Declaration

    Swift

    var producer: SignalProducer<Value, Never> { get }
  • A signal that will send the property’s changes over time. It completes when the property has deinitialized, or has no further change.

    Note

    If self is a composed property, the signal would be bound to the lifetime of its sources.

    Declaration

    Swift

    var signal: Signal<Value, Never> { get }
  • map(_:) Extension method

    Maps the current value and all subsequent values to a new property.

    Declaration

    Swift

    public func map<U>(_ transform: @escaping (Value) -> U) -> Property<U>

    Parameters

    transform

    A closure that will map the current value of this Property to a new value.

    Return Value

    A property that holds a mapped value from self.

  • map(value:) Extension method

    Map the current value and all susequent values to a new constant property.

    Declaration

    Swift

    public func map<U>(value: U) -> Property<U>

    Parameters

    value

    A new value.

    Return Value

    A property that holds a mapped value from self.

  • map(_:) Extension method

    Maps the current value and all subsequent values to a new property by applying a key path.

    Declaration

    Swift

    public func map<U>(_ keyPath: KeyPath<Value, U>) -> Property<U>

    Parameters

    keyPath

    A key path relative to the property’s Value type.

    Return Value

    A property that holds a mapped value from self.

  • filter(initial:_:) Extension method

    Passes only the values of the property that pass the given predicate to a new property.

    Declaration

    Swift

    public func filter(initial: Value, _ predicate: @escaping (Value) -> Bool) -> Property<Value>

    Parameters

    initial

    A Property always needs a value. The initial value is necessary in case the predicate excludes the first (or all) values of this Property

    predicate

    A closure that accepts value and returns Bool denoting whether current value of this Property has passed the test.

    Return Value

    A property that holds only values from self passing the given predicate.

  • combineLatest(with:) Extension method

    Combines the current value and the subsequent values of two Propertys in the manner described by Signal.combineLatest(with:).

    Declaration

    Swift

    public func combineLatest<P>(with other: P) -> Property<(Value, P.Value)> where P : PropertyProtocol

    Parameters

    other

    A property to combine self‘s value with.

    Return Value

    A property that holds a tuple containing values of self and the given property.

  • zip(with:) Extension method

    Zips the current value and the subsequent values of two Propertys in the manner described by Signal.zipWith.

    Declaration

    Swift

    public func zip<P>(with other: P) -> Property<(Value, P.Value)> where P : PropertyProtocol

    Parameters

    other

    A property to zip self‘s value with.

    Return Value

    A property that holds a tuple containing values of self and the given property.

  • combinePrevious(_:) Extension method

    Forward events from self with history: values of the returned property are a tuple whose first member is the previous value and whose second member is the current value. initial is supplied as the first member when self sends its first value.

    Declaration

    Swift

    public func combinePrevious(_ initial: Value) -> Property<(Value, Value)>

    Parameters

    initial

    A value that will be combined with the first value sent by self.

    Return Value

    A property that holds tuples that contain previous and current values of self.

  • skipRepeats(_:) Extension method

    Forward only values from self that are not considered equivalent to its consecutive predecessor.

    Note

    The first value is always forwarded.

    Declaration

    Swift

    public func skipRepeats(_ isEquivalent: @escaping (Value, Value) -> Bool) -> Property<Value>

    Parameters

    isEquivalent

    A closure to determine whether two values are equivalent.

    Return Value

    A property which conditionally forwards values from self.

  • flatMap(_:_:) Extension method

    Maps each property from self to a new property, then flattens the resulting properties (into a single property), according to the semantics of the given strategy.

    Declaration

    Swift

    public func flatMap<P: PropertyProtocol>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> P) -> Property<P.Value>

    Parameters

    strategy

    The preferred flatten strategy.

    transform

    The transform to be applied on self before flattening.

    Return Value

    A property that sends the values of its inner properties.

  • uniqueValues(_:) Extension method

    Forward only those values from self that have unique identities across the set of all values that have been held.

    Note

    This causes the identities to be retained to check for uniqueness.

    Declaration

    Swift

    public func uniqueValues<Identity: Hashable>(_ transform: @escaping (Value) -> Identity) -> Property<Value>

    Parameters

    transform

    A closure that accepts a value and returns identity value.

    Return Value

    A property that sends unique values during its lifetime.

  • combineLatest(_:_:) Extension method

    Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B>(_ a: A, _ b: B) -> Property<(A.Value, B.Value)> where A : PropertyProtocol, B : PropertyProtocol, Self.Value == A.Value
  • combineLatest(_:_:_:) Extension method

    Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C>(_ a: A, _ b: B, _ c: C) -> Property<(Value, B.Value, C.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, Self.Value == A.Value
  • combineLatest(_:_:_:_:) Extension method

    Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D>(_ a: A, _ b: B, _ c: C, _ d: D) -> Property<(Value, B.Value, C.Value, D.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, Self.Value == A.Value
  • combineLatest(_:_:_:_:_:) Extension method

    Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D, E>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E) -> Property<(Value, B.Value, C.Value, D.Value, E.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, Self.Value == A.Value
  • combineLatest(_:_:_:_:_:_:) Extension method

    Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D, E, F>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, Self.Value == A.Value
  • Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D, E, F, G>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, Self.Value == A.Value
  • Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D, E, F, G, H>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, H : PropertyProtocol, Self.Value == A.Value
  • Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D, E, F, G, H, I>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, H : PropertyProtocol, I : PropertyProtocol, Self.Value == A.Value
  • Combines the values of all the given properties, in the manner described by combineLatest(with:).

    Declaration

    Swift

    public static func combineLatest<A, B, C, D, E, F, G, H, I, J>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I, _ j: J) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value, J.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, H : PropertyProtocol, I : PropertyProtocol, J : PropertyProtocol, Self.Value == A.Value
  • combineLatest(_:) Extension method

    Combines the values of all the given producers, in the manner described by combineLatest(with:). Returns nil if the sequence is empty.

    Declaration

    Swift

    public static func combineLatest<S>(_ properties: S) -> Property<[S.Iterator.Element.Value]>? where S : Sequence, S.Element : PropertyProtocol
  • zip(_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B>(_ a: A, _ b: B) -> Property<(Value, B.Value)> where A : PropertyProtocol, B : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C>(_ a: A, _ b: B, _ c: C) -> Property<(Value, B.Value, C.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D>(_ a: A, _ b: B, _ c: C, _ d: D) -> Property<(Value, B.Value, C.Value, D.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D, E>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E) -> Property<(Value, B.Value, C.Value, D.Value, E.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D, E, F>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D, E, F, G>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D, E, F, G, H>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, H : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:_:_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D, E, F, G, H, I>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, H : PropertyProtocol, I : PropertyProtocol, Self.Value == A.Value
  • zip(_:_:_:_:_:_:_:_:_:_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:).

    Declaration

    Swift

    public static func zip<A, B, C, D, E, F, G, H, I, J>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I, _ j: J) -> Property<(Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value, J.Value)> where A : PropertyProtocol, B : PropertyProtocol, C : PropertyProtocol, D : PropertyProtocol, E : PropertyProtocol, F : PropertyProtocol, G : PropertyProtocol, H : PropertyProtocol, I : PropertyProtocol, J : PropertyProtocol, Self.Value == A.Value
  • zip(_:) Extension method

    Zips the values of all the given properties, in the manner described by zip(with:). Returns nil if the sequence is empty.

    Declaration

    Swift

    public static func zip<S>(_ properties: S) -> Property<[S.Iterator.Element.Value]>? where S : Sequence, S.Element : PropertyProtocol

Available where Value: Equatable

  • skipRepeats() Extension method

    Forward only values from self that are not equal to its consecutive predecessor.

    Note

    The first value is always forwarded.

    Declaration

    Swift

    public func skipRepeats() -> Property<Value>

    Return Value

    A property which conditionally forwards values from self.

Available where Value: PropertyProtocol

  • flatten(_:) Extension method

    Flattens the inner property held by self (into a single property of values), according to the semantics of the given strategy.

    Declaration

    Swift

    public func flatten(_ strategy: FlattenStrategy) -> Property<Value.Value>

    Parameters

    strategy

    The preferred flatten strategy.

    Return Value

    A property that sends the values of its inner properties.

Available where Value: Hashable

  • uniqueValues() Extension method

    Forwards only those values from self that are unique across the set of all values that have been seen.

    Note

    This causes the identities to be retained to check for uniqueness. Providing a function that returns a unique value for each sent value can help you reduce the memory footprint.

    Declaration

    Swift

    public func uniqueValues() -> Property<Value>

    Return Value

    A property that sends unique values during its lifetime.

Available where Value == Bool

  • negate() Extension method

    Create a property that computes a logical NOT in the latest values of self.

    Declaration

    Swift

    public func negate() -> Property<Value>

    Return Value

    A property that contains the logical NOT results.

  • and(_:) Extension method

    Create a property that computes a logical AND between the latest values of self and property.

    Declaration

    Swift

    public func and<P>(_ property: P) -> Property<Value> where P : PropertyProtocol, P.Value == Bool

    Parameters

    property

    Property to be combined with self.

    Return Value

    A property that contains the logical AND results.

  • all(_:) Extension method

    Create a property that computes a logical AND between the latest values of properties.

    Declaration

    Swift

    public static func all<P, Properties>(_ properties: Properties) -> Property<Value> where P : PropertyProtocol, P == Properties.Element, Properties : Collection, P.Value == Bool

    Parameters

    property

    Collection of properties to be combined.

    Return Value

    A property that contains the logical AND results.

  • or(_:) Extension method

    Create a property that computes a logical OR between the latest values of self and property.

    Declaration

    Swift

    public func or<P>(_ property: P) -> Property<Value> where P : PropertyProtocol, P.Value == Bool

    Parameters

    property

    Property to be combined with self.

    Return Value

    A property that contains the logical OR results.

  • any(_:) Extension method

    Create a property that computes a logical OR between the latest values of properties.

    Declaration

    Swift

    public static func any<P, Properties>(_ properties: Properties) -> Property<Value> where P : PropertyProtocol, P == Properties.Element, Properties : Collection, P.Value == Bool

    Parameters

    properties

    Collection of properties to be combined.

    Return Value

    A property that contains the logical OR results.