Search code examples
iosswiftrx-swift

How to manually perform action for UITextField editing changed observed with rx?


I simply added two observables:

    mainView.textField.rx.text.orEmpty.bind(to: viewModel.searchPhrase).disposed(by: bag)
    mainView.textField.rx.controlEvent(.editingChanged).asObservable().subscribe(onNext: { [weak self] in
       print("voilala")
    }).disposed(by: bag)

Now I would like to call actions from code to perform subscriptions and binding. Is it possible?


Solution

  • Simply:

    view.textField.insertText("someText")