Swift expected type Array <_>

I am trying to write a UITableView RAC3 helper helper in swift 2.

I am trying to initialize my binding helper that has a signature init(tableView: UITableView, sourceSignal: SignalProducer<[T], NoError>, reuseIdentifier: String, selectionCommand: (() -> Void)? = nil)

My code self.bindingHelper = TableViewBindingHelper<PostCellViewModel>(tableView: tableView, sourceSignal: viewModel.posts.producer, reuseIdentifier: R.reuseIdentifier.contactReuseIdentifier.identifier)

I get a compiler error on sourceSignal: viewModel.posts.producersaying that Cannot convert value of type 'SignalProducer<[PostCellViewModel], NoError>' (aka 'SignalProducer<Array<PostCellViewModel>, NoError>') to expected argument type 'SignalProducer<[_], NoError>' (aka 'SignalProducer<Array<_>, NoError>')that doesn't make sense ...

They say he expects SignalProducer<[_], NoError>. I assumed that _ means it doesn't care what type I pass, but then I try to pass an array from PostCellViewModel, does it fail?

+4
source share

Source: https://habr.com/ru/post/1610129/


All Articles