Привет товарищи! У меня есть tableView, которая ищет информацию по апи. При выборе информация открывается другой TableViewController с кастомными 3мя ячейками. Вопрос в следующем:
Как передать информацию с 1ого tableViewController’a во 2й tableViewController(с кастомными ячейками) ? + Создал я 3 кастомные ячейки. Одну кастомную ячейку я передал в TableViewController(который принимает в себя информацию с первого). Далее код 2ого TableViewController’a:
@IBOutlet weak var weatherTable: UITableView!
var weatherList = [Weather]()
override func viewDidLoad() {
super.viewDidLoad()
let nibb = UINib.init(nibName: "CustomTableViewCellTwo", bundle: nil)
let nibbb = UINib.init(nibName: "CustomTableViewCellThree", bundle: nil)
let nib = UINib.init(nibName: "CustomTableViewCell", bundle: nil)
self.weatherTable.register(nib, forCellReuseIdentifier: "CustomTableViewCell")
self.weatherTable.register(nibb, forCellReuseIdentifier: "CustomTableViewCellTwo")
self.weatherTable.register(nibbb, forCellReuseIdentifier: "CustomTableViewCellThree")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
weather.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomTableViewCell", for: indexPath) as! CustomTableViewCell
cell.nameWeather.text = weatherList[indexPath.row].strWeather
cell.imageWeather.image = #imageLiteral(resourceName: "WeatherDetails")
return cell
}
}
Как тут еще привязать 2 кастомные ячейки и передать туда другие данные?
P.S код в первом tableViewController’e стандартный(функции запроса и вывода информации)