При передачи struct(массива) в cellForRowAt пишет Cannot assign value of type '' to type 'String'


#1

Спарсил я ответ c API и получил его по структуре:
struct apiListData: Codable {
let weather: [Weather]
}

struct Weather: Codable {
let stWeather: String
}

пытаюсь теперь передать значения с ответа в tableView:
class MainTableViewController: UITableViewController {

var weatherList = [apiListData]()

  override func viewDidLoad() {
    super.viewDidLoad()
    
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
return weatherList.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
    cell.textLabel?.text = weatherList[indexPath.row]

    return cell
}

cell.textLabel?.text = weatherList[indexPath.row] - тут пишет ошибку "Cannot assign value of type ‘apiListData’ to type ‘String’ "

как это исправить друзья ?


#2

Еще раз посмотрите что вы передаете. Вы не ту структуру отдаете.
Вы передаете массив, вместо строки.


#3

разобрался, спасибо!