jeudi 2 août 2018

How to force tap on UIButton using RxSwift?

This is how I subscribe for tap action on UIButton:

    _ = mainView.loginButton.rx.tap.subscribe { _ in

        //this is not called at all
    }

and now I need to force that action to check if my dependencies work great, but subscribe handler is not called.

func testRouterDidCallWithError() {
    let view = LoginView()
    let controller = LoginViewController(view: view)
    controller.loadView()
    view.loginButton.sendActions(for: .touchUpInside) //here is the point
    XCTAssertTrue(router.alertWasCalled)
}

Aucun commentaire:

Enregistrer un commentaire