title: How to read the changes in UISwitch in a custom UITableViewCell
body: <p>Although I've found similar questions asked, I'm not able to comprehend the answers for it.</p>
  
  <p>How would we read the changes in <code>UISwitch</code> or for that matter any element while in a <code>UITableViewCell</code>? Tried using a protocol, but the custom cell class complains about no initialisers. Used, a delegate, which seems to not conform to the view controller.</p>
  
  <pre><code>protocol SwitchTableViewCellDelegate {
      func didChangeSwitchValue(value: Bool)
  }
  
  class SwitchTableViewCell: UITableViewCell {
  
  var delegate: SwitchTableViewCellDelegate
  var value: Bool =  true
  
  @IBOutlet weak var switchCellLabel: UILabel!
  @IBOutlet weak var switchCellSwitch: UISwitch!
  @IBAction func changedSwitchValue(sender: UISwitch) {
      self.value = sender.on
      delegate.didChangeSwitchValue(value)
  }
  </code></pre>
  
  <p>In <code>cellForRowAtIndexPath</code>,</p>
  
  <pre><code>let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! SwitchTableViewCell
                  cell.delegate = self
                  cell.switchCellLabel?.text = "Show Cloud Music"
                  cell.switchCellSwitch.on = userDefaults.boolForKey(cloudMusicKey)
  </code></pre>
  
  <p>Any suggestions, on how to implement this?</p>