RxSwiftCommunity / RxKingfisher

Reactive extension for the Kingfisher image downloading and caching library
MIT License
223 stars 39 forks source link

Cannot invoke 'bind' with an argument list of type '(to: Binder<Resource?>)' #13

Closed phuhk closed 5 years ago

phuhk commented 5 years ago

Hi there, I'm just following the doc and receive "Cannot invoke 'bind' with an argument list of type '(to: Binder<Resource?>)'" error. Please help me check if my code have any issue

viewModel.user.map { user -> NSURL in return NSURL.init(string: user.avatar) ?? NSURL.init() } .bind(to: avatarImageView.kf.rx.image()) .disposed(by: rx.disposeBag)

kasyanov-ms commented 5 years ago

NSURL doesn't conform to Resource type. Use URL instead:

viewModel
    .user
    .map { user in URL(string: user.avatar) }
    .bind(to: avatarImageView.kf.rx.image())
    .disposed(by: rx.disposeBag)
freak4pc commented 5 years ago

NSURL is deprecated, please use URL instead.

dfmarulanda commented 5 years ago

Instance method 'bind(to:)' requires the types 'URL?' and 'Resource?' be equivalent

freak4pc commented 5 years ago

I think you have to unwrap your URL.

Terriermon commented 5 years ago

Instance method 'bind(to:)' requires the types 'URL' and 'Resource?' be equivalent

Terriermon commented 5 years ago

I unwrap the URL but the problem has always existed

malonehedges commented 5 years ago

@Terriermon did you ever resolve the issue Instance method 'bind(to:)' requires the types 'URL' and 'Resource?' be equivalent