title: How to get table all current row information
body: <p>I am new to swift . i am doing my project programatically and I load data from api to the tableView and tableView like ios setting page  ..
  <a href="https://i.stack.imgur.com/IWpNT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IWpNT.png" alt="enter image description here"></a></p>
  
  <p>now i need all rows information when click "Add to cart" button. How can i do it? </p>
  
  <p>here is my code sample :</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
  
      switch indexPath.section {
      case 0:
          let cell = tableView.dequeueReusableCell(withIdentifier: cartHeaderCell, for: indexPath) as! CartHeaderCell
  
          cell.configureCell(indexPath.item)
  
          return cell
  
      case 1:
  
          let obj = data?[indexPath.row]
  
          var cell = UITableViewCell()
  
  
          switch obj {
          case  is Addon:
  
              cell = tableView.dequeueReusableCell(withIdentifier: addonCell, for: indexPath) as! AddonCell
  
              let switchView = UISwitch(frame: .zero)
  
              switchView.setOn(false, animated: true)
  
  
  
              cell.accessoryView = switchView
  
  
              guard let addon = obj as? Addon else {
  
                  return cell
  
              }
  
              cell.textLabel?.text = "\(addon.name) + €\(addon.price)"
  
          case  is AddonGroup:
  
              cell = tableView.dequeueReusableCell(withIdentifier: addonGroupCell, for: indexPath) as! AddonGroupCell
              cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
  
              guard let addonGroup = obj as? AddonGroup else {
  
                  return cell
  
              }
  
              if let addons = addonGroup.addonList {
  
                  cell.detailTextLabel?.text = ""
                  var selectedAddons = ""
                  for _addon in addons
                  {
                      if _addon.isSelect == true {
  
                          selectedAddons = selectedAddons + "\(_addon.name)"
  
  
                      }  
  
                  }
  
                  cell.detailTextLabel?.text = selectedAddons
              }
  
              cell.textLabel?.text = addonGroup.name
           ...........................................
  </code></pre>