title: how to update data in tableview (Swift)
body: <p>I have two Swift files: NotificationsViewController and ViewController.
  The firstArray is updated  in the ViewContoller when a button is tapped. I was able to print the updated data. However, when I switch back to NotificationsViewController the tableview is not updated when I pull to refresh.</p>
  
  <p>NotificationsViewController:</p>
  
  <pre><code>import Foundation
  import UIKit
  
  var  firstArray : [String] = ["123","1234"]
  
  class NotificationsViewController: UITableViewController {
  
  
      var refresher: UIRefreshControl!
  
      var data: [[String]] = [firstArray, ["4","5"]]
  
      func refresh(){
  
          print("refreshed")
          self.tableView.reloadData()
          self.refresher.endRefreshing()
  
      }
  
      override func viewDidLoad() {
  
  
          refresher = UIRefreshControl()
          refresher.attributedTitle = NSAttributedString(string: "pull to refresh")
  
          refresher.addTarget(self, action: #selector(NotificationsViewController.refresh), forControlEvents: UIControlEvents.ValueChanged)
          self.tableView.addSubview(refresher)
          refresh()
  
  
          super.viewDidLoad()
          self.tableView.editing = true
  
      }
  
      override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
        return data.count
  
      }
      override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
  
  
          return data[section].count
  
      }
  
  
      override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
          let cell: UITableViewCell = UITableViewCell(style: .Subtitle, reuseIdentifier: "tableCell")
  
          cell.textLabel?.text = data[indexPath.section][indexPath.row]
  
          return cell
      }
  
      override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
          if editingStyle == .Delete {
  
              data[indexPath.section].removeAtIndex(indexPath.row)
              tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
  
  
  
          }
      }
  
  }
  </code></pre>
  
  <p>ViewController: </p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      @IBAction func button(sender: AnyObject) {
                firstArray.append("522")
                print(firstArray)
  
      }
  
  
  }
  </code></pre>
  
  <p>I tried <a href="https://github.com/DharmeshKheni/post-notification" rel="noreferrer">this</a> but it did not work too.</p>
  
  <p>Updated : </p>
  
  <p>How can I update a value of cell.detailTextLabel?.text that is based on another array?</p>
  
  <p>Thank you in advance </p>