ReadWriteProperty

open class ReadWriteProperty<T> : BindableProperty<T>, ReadablePropertyType

Base class for properties that can be both read from and written to, i.e. is capable of bidirectional binding.

  • Declaration

    Swift

    public typealias Value = T
  • Declaration

    Swift

    public var value: T { get }
  • Declaration

    Swift

    public var signal: Signal<T> { get }
  • Establishes a bidirectional binding between this property and the given property. When this property’s value changes, the other property’s value will be updated and vice versa. Note that calling bindBidi will cause this property to take on the other property’s value immedately.

    Declaration

    Swift

    public func bindBidi(_ other: ReadWriteProperty<T>) -> Binding
  • Establishes a bidirectional connection between this property and the given property, using leftToRight and rightToLeft to conditionally apply changes in each direction.

    Declaration

    Swift

    public func connectBidi<U>(_ rhs: ReadWriteProperty<U>,
                               leftToRight: @escaping (_ value: T, _ isInitial: Bool) -> ChangeResult<U>,
                               rightToLeft: @escaping (_ value: U, _ isInitial: Bool) -> ChangeResult<T>) -> Binding
  • Establishes a bidirectional binding between this property and the given property. When this property’s value changes, the other property’s value will be updated and vice versa. Note that calling bindBidi will cause this property to take on the other property’s value immedately (if the value is defined).

    Declaration

    Swift

    public func bindBidi(_ other: AsyncReadWriteProperty<T>) -> Binding
  • Returns a ReadWriteProperty that supports bidirectional transformation of the underlying value.

    Declaration

    Swift

    public func mapBidi<U: Equatable>(outgoing: @escaping (T) -> U, incoming: @escaping (U) -> T) -> ReadWriteProperty<U>

    Parameters

    outgoing

    The transformation to apply when the underlying value is changing (going out to another property).

    incoming

    The transformation to apply when a new value is coming in from another property.