0

How can I bind a UITextView's text property to a MutableProperty, e.g.

let property = MutableProperty<String>("")
commentTextView.text <~ property

This just gives me the error

Binary operator '<~' cannot be applied to operands of type 'String!' and 'MutableProperty<String>'

but I don't understand why.

Is there a documentation somewhere of how the bindings work in ReactiveSwift?

I checked a couple of potential sources, such as the very brief documentation on the GitHub project and reactivecocoa.io, but after reading them I get the feeling that ReactiveSwift is not capable of doing this.

I also read another similar question, but the accepted answer does not seem to apply in this case or is wrong.

Community
  • 1
  • 1
Raphael
  • 2,691
  • 1
  • 16
  • 21

1 Answers1

1

This was a syntactical misunderstanding that was not so clear to me from the sparse ReactiveSwift documentation. One has to add a .reactive in between:

let property = MutableProperty<String>("")
commentTextView.reactive.text <~ property
Raphael
  • 2,691
  • 1
  • 16
  • 21