Hello,
I need to choose element from table, then choose again second element from this same table view, then display them in another controller together in one table.
I try do this by the way of creating two variables of this same property, and distinguish, which is tapped, but I don't know how.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//let firstCurrency = [rates[indexPath.row]]
// let secondCurrency = [rates[indexPath.row]]
let firsCurrency = [rates[indexPath.row].pair.source.name]
let secondCurrency = [rates[indexPath.row].pair.target.name]
let vcRates = RatesViewController()
let vcSelf = CurrencyViewController()
if firsCurrency.contains(where: {$0.count == 1}) {
vcSelf.modalPresentationStyle = .fullScreen
} else {
vcRates.modalPresentationStyle = .fullScreen
}
//vc.modalPresentationStyle = .fullScreen
}
In here you can see "rates" property which is model from API.
And so on a little of my mess.
At the end my question is, how I can assign value from tableview to firstCurrency at the first time, then somehow assign value to the secondCurrency, at the second.
Thanks for help.