PropertyProtocol
public protocol PropertyProtocol: class, 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
-
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
Ifself
is a composed property, the producer would be bound to the lifetime of its sources.Declaration
Swift
var producer: SignalProducer<Value, NoError>
-
A signal that will send the property’s changes over time. It completes when the property has deinitialized, or has no further change.
Note
Ifself
is a composed property, the signal would be bound to the lifetime of its sources.Declaration
Swift
var signal: Signal<Value, NoError>
-
observe(_:during:)
Extension methodObserve the property by sending all of future value changes to the given
observer
during the givenlifetime
.Declaration
Swift
public func observe(_ observer: Observer<Value, NoError>, during lifetime: Lifetime) -> Disposable?
Parameters
observer
An observer to send the events to.
lifetime
A lifetime of the observing object.
-
map(_:)
Extension methodMaps 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 thisProperty
to a new value.Return Value
A property that holds a mapped value from
self
. -
combineLatest(with:)
Extension methodCombines the current value and the subsequent values of two
Property
s in the manner described bySignal.combineLatest(with:)
.Declaration
Swift
public func combineLatest<P: PropertyProtocol>(with other: P) -> Property<(Value, P.Value)>
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 methodZips the current value and the subsequent values of two
Property
s in the manner described bySignal.zipWith
.Declaration
Swift
public func zip<P: PropertyProtocol>(with other: P) -> Property<(Value, P.Value)>
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 methodForward 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 whenself
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 methodForward only those values from
self
which do not passisRepeat
with respect to the previous value.Declaration
Swift
public func skipRepeats(_ isRepeat: @escaping (Value, Value) -> Bool) -> Property<Value>
Parameters
isRepeat
A predicate to determine if the two given values are equal.
Return Value
A property that does not emit events for two equal values sequentially.
-
flatMap(_:transform:)
Extension methodMaps 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 methodForward 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 methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol>(_ a: A, _ b: B) -> Property<(A.Value, B.Value)> where Value == A.Value
-
combineLatest(_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol>(_ a: A, _ b: B, _ c: C) -> Property<(A.Value, B.Value, C.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D) -> Property<(A.Value, B.Value, C.Value, D.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol, H: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:_:_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol, H: PropertyProtocol, I: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value)> where Value == A.Value
-
combineLatest(_:_:_:_:_:_:_:_:_:_:)
Extension methodCombines the values of all the given properties, in the manner described by
combineLatest(with:)
.Declaration
Swift
public static func combineLatest<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol, H: PropertyProtocol, I: PropertyProtocol, J: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I, _ j: J) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value, J.Value)> where Value == A.Value
-
combineLatest(_:)
Extension methodCombines 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: Sequence>(_ properties: S) -> Property<[S.Iterator.Element.Value]>? where S.Iterator.Element: PropertyProtocol
-
zip(_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol>(_ a: A, _ b: B) -> Property<(A.Value, B.Value)> where Value == A.Value
-
zip(_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol>(_ a: A, _ b: B, _ c: C) -> Property<(A.Value, B.Value, C.Value)> where Value == A.Value
-
zip(_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D) -> Property<(A.Value, B.Value, C.Value, D.Value)> where Value == A.Value
-
zip(_:_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value)> where Value == A.Value
-
zip(_:_:_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value)> where Value == A.Value
-
zip(_:_:_:_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value)> where Value == A.Value
-
zip(_:_:_:_:_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol, H: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value)> where Value == A.Value
-
zip(_:_:_:_:_:_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol, H: PropertyProtocol, I: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value)> where Value == A.Value
-
zip(_:_:_:_:_:_:_:_:_:_:)
Extension methodZips the values of all the given properties, in the manner described by
zip(with:)
.Declaration
Swift
public static func zip<A: PropertyProtocol, B: PropertyProtocol, C: PropertyProtocol, D: PropertyProtocol, E: PropertyProtocol, F: PropertyProtocol, G: PropertyProtocol, H: PropertyProtocol, I: PropertyProtocol, J: PropertyProtocol>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I, _ j: J) -> Property<(A.Value, B.Value, C.Value, D.Value, E.Value, F.Value, G.Value, H.Value, I.Value, J.Value)> where Value == A.Value
-
zip(_:)
Extension methodZips 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: Sequence>(_ properties: S) -> Property<[S.Iterator.Element.Value]>? where S.Iterator.Element: PropertyProtocol
-
skipRepeats()
Extension methodForward only those values from
self
which do not passisRepeat
with respect to the previous value.Declaration
Swift
public func skipRepeats() -> Property<Value>
Return Value
A property that does not emit events for two equal values sequentially.
-
flatten(_:)
Extension methodFlattens 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.
-
uniqueValues()
Extension methodForwards 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.