title: How to store data from a specific cell with an Action?
body: <p>I have a <code>ViewController</code> with a <code>TableView</code> inside.
  I also have a <code>TableViewCell</code> Controller.</p>
  
  <p>Each cell of my table have informations from Firebase and a button.</p>
  
  <p>The objective here is to add into my database an information of my cell when I click on the button.</p>
  
  <p>Basically, I have a list of songs with an <code>add button</code> on each, and I want to add a song into my user account when I click on <code>add</code>.</p>
  
  <p>The list of songs is well displayed, but I don't know how to put an information from this song into my database when I click on the "add" button.</p>
  
  <p><strong>Model code:</strong></p>
  
  <pre><code>import Foundation
  
  class ServiceModel {
  
      var name: String?
      var category: String?
      var pricing: String?
  
      init(name: String?, category: String?, pricing: String?){
          self.name = name
          self.category = category
          self.pricing = pricing
      }
  }
  </code></pre>
  
  <p><strong>TableViewCell code:</strong></p>
  
  <pre><code>class PopularTableViewCell: UITableViewCell {
  
      @IBOutlet weak var imageService: UIImageView!
      @IBOutlet weak var labelName: UILabel!
      @IBOutlet weak var labelCategory: UILabel!
      @IBOutlet weak var labelPricing: UILabel!
  </code></pre>
  
  <p>ViewController code:</p>
  
  <pre><code>import UIKit
  import FirebaseDatabase
  import FirebaseAuth
  
  class AddSubViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
  
      var refServices:DatabaseReference!
  
      @IBOutlet weak var ListPop: UITableView!
  
      var serviceList = [ServiceModel]()
  
      var databaseHandle:DatabaseHandle?
  
      let userID = Auth.auth().currentUser?.uid
  
  
      @IBAction func addSub(_ sender: Any) {
  
          let ref = Database.database().reference()
              let usersReference = ref.child("users")
              let uid = Auth.auth().currentUser?.uid
              let thisUserReference = usersReference.child(uid!).child("subs").childByAutoId()
          thisUserReference.setValue("test")
  
  **// I want to put the pricing value of the song of my cell instead of "test" in: setValue("test")**
  
      }
  
      public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
          return serviceList.count
      }
  
      public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          let cell = tableView.dequeueReusableCell(withIdentifier: "PopCell", for: indexPath) as! PopularTableViewCell
  
          let service: ServiceModel
  
          service = serviceList[indexPath.row]
  
          cell.imageService?.image = UIImage(named: service.name! + ".png")
          cell.labelName?.text = service.name
          cell.labelCategory?.text = service.category
          cell.labelPricing?.text = service.pricing
  
          return cell
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          ListPop.delegate = self
          ListPop.dataSource = self
  
          refServices = Database.database().reference().child("Categories")
  
          refServices.observe(DataEventType.value, with: { (snapshot) in
  
              if snapshot.childrenCount &gt; 0 {
  
                  self.serviceList.removeAll()
  
                  for services in snapshot.children.allObjects as! [DataSnapshot] {
                      let serviceObject = services.value as? [String: AnyObject]
                      let serviceName  = serviceObject?["Name"]
                      let serviceCategory  = serviceObject?["Category"]
                      let servicePricing = serviceObject?["Pricing"] as! String + " €"
                      let service = ServiceModel(name: serviceName as! String?, category: serviceCategory as! String?, pricing: servicePricing as String?)
  
                      self.serviceList.append(service)
                  }
  
                  self.ListPop.reloadData()
              }
          })
      }
  
  }
  </code></pre>
  
  <p>I want to put the pricing value of the song of my cell instead of "test" in: <code>setValue("test")</code></p>