AndrewSB
AndrewSB

Reputation: 951

Swift expected type Array<_>

I'm trying to write a UITableView RAC3 Binding helper in swift 2.

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

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

I get a compiler error on the sourceSignal: viewModel.posts.producer, saying that Cannot convert value of type 'SignalProducer<[PostCellViewModel], NoError>' (aka 'SignalProducer<Array<PostCellViewModel>, NoError>') to expected argument type 'SignalProducer<[_], NoError>' (aka 'SignalProducer<Array<_>, NoError>'), which makes no sense to...

It's saying that it's expecting a SignalProducer<[_], NoError>. I assumed the _ means it doesn't care what type I pass in, but then I try to pass in an array of PostCellViewModel it fails?

Upvotes: 4

Views: 436

Answers (0)

Related Questions