I want to display the value of the table view cell on the screen. However, the following error occurs:
Cannot assign value of type ‘[listenings]’ to type ‘ProfileModel’
I think there is no problem with the model.
func bindViewModel() {
let input = ListenViewModel.input(loadData: loadData.asSignal(onErrorJustReturn: ()))
let output = viewModel.transform(input)
output.loadApplyList.map(CollectionOfOne.init).bind(to: tableView.rx.items) { tableView, index, element -> UITableViewCell in
guard let cell = self.tableView.dequeueReusableCell(withIdentifier: "ListeningTableViewCell") as? ListeningTableViewCell else {
return ListeningTableViewCell()
}
cell.listeningData = element.listen
}.disposed(by: disposeBag)
}
This is my ViewController code. Error occurs in 'cell.listingdata large = element.listen'
class target: Codable {
let nickname: String
let image: String
let listening: Int
let listener: Int
let isMine: Bool
}
class listen: Codable {
let listen: [listenings]
}
class listenings: Codable {
let nickname: String
let image: String
let listener: Int
let listening: Int
let isListening: Int
}
And this is my Model code.
How to solve this error?
question from:
https://stackoverflow.com/questions/65540985/cannot-assign-value-of-type-model-to-type-model 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…