Bindings

  • Describes a source which can be bound.

    See more

    Declaration

    Swift

    public protocol BindingSource
  • A binding target that can be used with the <~ operator.

    See more

    Declaration

    Swift

    public struct BindingTarget<Value>: BindingTargetProvider
  • Describes an entity which be bond towards.

    Declaration

    Swift

    public protocol BindingTargetProvider
  • Binds a source to a target, updating the target’s value to the latest value sent by the source.

    Note

    The binding will automatically terminate when the target is deinitialized, or when the source sends a completed event.
    let property = MutableProperty(0)
    let signal = Signal({ /* do some work after some time */ })
    property <~ signal
    
    let property = MutableProperty(0)
    let signal = Signal({ /* do some work after some time */ })
    let disposable = property <~ signal
    ...
    // Terminates binding before property dealloc or signal's
    // `completed` event.
    disposable.dispose()
    

    Declaration

    Swift

    public func <~
    	<Provider: BindingTargetProvider, Source: BindingSource>
    	(provider: Provider, source: Source) -> Disposable?
    	where Source.Value == Provider.Value, Source.Error == NoError

    Parameters

    target

    A target to be bond to.

    source

    A source to bind.

    Return Value

    A disposable that can be used to terminate binding before the deinitialization of the target or the source’s completed event.

  • Binds a source to a target, updating the target’s value to the latest value sent by the source.

    Note

    The binding will automatically terminate when the target is deinitialized, or when the source sends a completed event.
    let property = MutableProperty(0)
    let signal = Signal({ /* do some work after some time */ })
    property <~ signal
    
    let property = MutableProperty(0)
    let signal = Signal({ /* do some work after some time */ })
    let disposable = property <~ signal
    ...
    // Terminates binding before property dealloc or signal's
    // `completed` event.
    disposable.dispose()
    

    Declaration

    Swift

    public func <~
    	<Provider: BindingTargetProvider, Source: BindingSource>
    	(provider: Provider, source: Source) -> Disposable?
    	where Provider.Value: OptionalProtocol, Source.Value == Provider.Value.Wrapped, Source.Error == NoError

    Parameters

    target

    A target to be bond to.

    source

    A source to bind.

    Return Value

    A disposable that can be used to terminate binding before the deinitialization of the target or the source’s completed event.