Skip to content

Instantly share code, notes, and snippets.

@buddies2705
Created January 28, 2019 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buddies2705/89cd05d90d5fda3ac8532db2f99b3e1c to your computer and use it in GitHub Desktop.
Save buddies2705/89cd05d90d5fda3ac8532db2f99b3e1c to your computer and use it in GitHub Desktop.
ListTableViewController
class ListTableViewController: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: "DataTableViewCell", for: indexPath) as? DataTableViewCell {
var koinObject : KoinModel?
if(self.currentIndex == 0){
koinObject = appDelegateObj().finalModelObject?.inrList[indexPath.row]
cell.iconImageView.image = UIImage(named: "rupees")
}
else if(self.currentIndex == 1){
koinObject = appDelegateObj().finalModelObject?.bitcoinList[indexPath.row]
cell.iconImageView.image = UIImage(named: "bitcoin")
}
else if(self.currentIndex == 2){
koinObject = appDelegateObj().finalModelObject?.etherList[indexPath.row]
cell.iconImageView.image = UIImage(named: "ether")
}
else{
koinObject = appDelegateObj().finalModelObject?.rippleList[indexPath.row]
cell.iconImageView.image = UIImage(named: "ripple")
}
cell.nameLabel.text = koinObject?.currencyFullForm?.capitalized
cell.name.text = koinObject?.currencyShortForm
cell.priceLabel.text = koinObject?.lastTradedPrice
cell.higherPrice.text = koinObject?.highestBid
cell.lowerPrice.text = koinObject?.lowestAsk
cell.selectionStyle = .none
return cell
}
return UITableViewCell()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment