RxSwift error. Cannot invoke 'drive' with an argument list of type '(Driver)'
up vote
0
down vote
favorite
I try to bind tap on button to Driver and got following error:
Cannot invoke 'drive' with an argument list of type '(Driver)'
ViewModel
var closeButtonDidTapObserver: Driver<Void> { get }
ViewController
closeButton.rx
.tap
.asDriver()
.drive(viewModel.input.closeButtonDidTapObserver)
How to resolve this?
ios swift mvvm binding rx-swift
add a comment |
up vote
0
down vote
favorite
I try to bind tap on button to Driver and got following error:
Cannot invoke 'drive' with an argument list of type '(Driver)'
ViewModel
var closeButtonDidTapObserver: Driver<Void> { get }
ViewController
closeButton.rx
.tap
.asDriver()
.drive(viewModel.input.closeButtonDidTapObserver)
How to resolve this?
ios swift mvvm binding rx-swift
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I try to bind tap on button to Driver and got following error:
Cannot invoke 'drive' with an argument list of type '(Driver)'
ViewModel
var closeButtonDidTapObserver: Driver<Void> { get }
ViewController
closeButton.rx
.tap
.asDriver()
.drive(viewModel.input.closeButtonDidTapObserver)
How to resolve this?
ios swift mvvm binding rx-swift
I try to bind tap on button to Driver and got following error:
Cannot invoke 'drive' with an argument list of type '(Driver)'
ViewModel
var closeButtonDidTapObserver: Driver<Void> { get }
ViewController
closeButton.rx
.tap
.asDriver()
.drive(viewModel.input.closeButtonDidTapObserver)
How to resolve this?
ios swift mvvm binding rx-swift
ios swift mvvm binding rx-swift
edited 4 hours ago
Denis
35313
35313
asked 6 hours ago
Aleksei Danilov
6517
6517
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
As you are getting Driver
from closeButton.rx .tap.asDriver()
then you don't need a separate Driver
object and you can remove this variable var closeButtonDidTapObserver: Driver { get }
.
In drive(...)
you need to pass the UI
element you want to bind with the button
.
Example,
closeButton.rx.tap.asDriver()
.drive(self.label.rx.text)
.disposed(by: disposeBag)
Or you can subscribe as below,
closeButton.rx.tap.asDriver()
.drive(onNext: { [weak self] in
// Update ui element here
}).disposed(by: disposeBag)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
As you are getting Driver
from closeButton.rx .tap.asDriver()
then you don't need a separate Driver
object and you can remove this variable var closeButtonDidTapObserver: Driver { get }
.
In drive(...)
you need to pass the UI
element you want to bind with the button
.
Example,
closeButton.rx.tap.asDriver()
.drive(self.label.rx.text)
.disposed(by: disposeBag)
Or you can subscribe as below,
closeButton.rx.tap.asDriver()
.drive(onNext: { [weak self] in
// Update ui element here
}).disposed(by: disposeBag)
add a comment |
up vote
0
down vote
As you are getting Driver
from closeButton.rx .tap.asDriver()
then you don't need a separate Driver
object and you can remove this variable var closeButtonDidTapObserver: Driver { get }
.
In drive(...)
you need to pass the UI
element you want to bind with the button
.
Example,
closeButton.rx.tap.asDriver()
.drive(self.label.rx.text)
.disposed(by: disposeBag)
Or you can subscribe as below,
closeButton.rx.tap.asDriver()
.drive(onNext: { [weak self] in
// Update ui element here
}).disposed(by: disposeBag)
add a comment |
up vote
0
down vote
up vote
0
down vote
As you are getting Driver
from closeButton.rx .tap.asDriver()
then you don't need a separate Driver
object and you can remove this variable var closeButtonDidTapObserver: Driver { get }
.
In drive(...)
you need to pass the UI
element you want to bind with the button
.
Example,
closeButton.rx.tap.asDriver()
.drive(self.label.rx.text)
.disposed(by: disposeBag)
Or you can subscribe as below,
closeButton.rx.tap.asDriver()
.drive(onNext: { [weak self] in
// Update ui element here
}).disposed(by: disposeBag)
As you are getting Driver
from closeButton.rx .tap.asDriver()
then you don't need a separate Driver
object and you can remove this variable var closeButtonDidTapObserver: Driver { get }
.
In drive(...)
you need to pass the UI
element you want to bind with the button
.
Example,
closeButton.rx.tap.asDriver()
.drive(self.label.rx.text)
.disposed(by: disposeBag)
Or you can subscribe as below,
closeButton.rx.tap.asDriver()
.drive(onNext: { [weak self] in
// Update ui element here
}).disposed(by: disposeBag)
edited 5 hours ago
answered 6 hours ago
Kamran
4,85711027
4,85711027
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370544%2frxswift-error-cannot-invoke-drive-with-an-argument-list-of-type-drivervoid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown