title: How to access cells of a table view of a view from another view in Swift?
body: <p>I have two view controllers : ManualViewController, AutomaticViewController
  ManualViewController has a table view with each cell having a label and a switch.</p>
  
  <p>How do I access these switches from AutomaticViewController?</p>
  
  <p>Heres my ManualViewController code:</p>
  
  <pre><code>import UIKit    
  class ManualViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
  
  @IBOutlet weak var tableView: UITableView!
  var objects: NSMutableArray! = NSMutableArray()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      self.navigationController?.navigationBarHidden = false
      self.navigationController?.navigationBar.barTintColor = UIColor.blackColor()
      self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
      self.tabBarController?.tabBar.barTintColor = UIColor.blackColor()
      // Do any additional setup after loading the view.
  
  
      self.objects.addObject("iPhone")
      self.objects.addObject("Apple Watch")
      self.objects.addObject("Mac")
  
      self.tableView.reloadData()
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int
  {
      return self.objects.count
  }
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell
  {
  
      let cell = self.tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! TableViewCell
      cell.deviceName.text = self.objects.objectAtIndex(indexPath.row) as? String
      cell.deviceState.tag = indexPath.row;
      return cell
  
  
  
  }
  
  
  
  @IBAction func whatToDo(sender: UISwitch) {
  
      var c = sender.tag
      if c == 2
      {
          if sender.on
          {
              println("on")
          }
          else
          {
              println("off")
          }
      }
   }
  
  }
  </code></pre>
  
  <p>`</p>