Спарсил я ответ 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’ "
как это исправить друзья ?