title: iOS Delegate is not being set and is returning nil (Swift)
body: <p>I am getting nil when I try to set a delegate, and can't figure out why the delegate is not properly set. </p>
  
  <p>I have a View Controller <code>ListViewController</code> which I add a subview to, <code>musicPlayer</code>. <code>musicPlayer</code> is a UIView which has some buttons that should trigger actions in <code>ListViewController</code> when clicked. </p>
  
  <p><code>musicPlayer</code> is set up like this:</p>
  
  <pre><code>protocol MusicPlayerControlsDelegate {
      func playPauseClicked()
  }
  
  
  class musicPlayer: UIView {
  
  var myDelegate: MusicPlayerControlsDelegate?
  
  //this should trigger function in delegate
  @IBAction func playOrPause(sender: AnyObject) {    
      println(myDelegate?)
      myDelegate?.playPauseClicked()        
  }
  </code></pre>
  
  <p><code>ListViewController</code> is set up like this:</p>
  
  <pre><code>class ListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, MusicPlayerControlsDelegate {
  
  var musicControls:musicPlayer = musicPlayer()
  
  override func viewDidLoad() {
      musicControls.myDelegate = self
  }
  
  //adds musicPlayer nib as a subview to ListViewController
  @IBAction func playInApp(sender: AnyObject) {
  
      let bundle = NSBundle(forClass: musicPlayer.self)
      var playerSubview = bundle.loadNibNamed("musicPlayerSubview", owner: nil, options: nil)[0] as UIView
      playerSubview.frame = CGRectMake(0, self.view.frame.width + 79, self.view.frame.width, 200)
  
      self.view.addSubview(playerSubview)
  }
  
  func playPauseClicked() {
      println("Your delegate is working")
  }
  </code></pre>
  
  <p>When I run this, <code>println(myDelegate)</code> is <code>nil</code> and <code>println("Your delegate is working")</code> never gets called. Any suggestions on how to fix this?</p>