title: swift NSTimer userinfo
body: <p>I'm trying to pass a UIButton with a NSTimer's userinfo. I've read every post on stackoverflow on NSTimers. I'm getting very close but can't quite get there. This post has helped </p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/27133228/swift-nstimer-retrieving-userinfo-as-cgpoint">Swift NSTimer retrieving userInfo as CGPoint</a></p>
  </blockquote>
  
  <pre><code>func timeToRun(ButonToEnable:UIButton) {
      var  tempButton = ButonToEnable
      timer = NSTimer.scheduledTimerWithTimeInterval(4, target: self, selector: Selector("setRotateToFalse"), userInfo: ["theButton" :tempButton], repeats: false)    
  }
  </code></pre>
  
  <p>the function the timer runs</p>
  
  <pre><code>func setRotateToFalse() {
      println(  timer.userInfo )// just see whats happening
  
      rotate = false
      let userInfo = timer.userInfo as Dictionary&lt;String, AnyObject&gt;
      var tempbutton:UIButton = (userInfo["theButton"] as UIButton)
      tempbutton.enabled = true
      timer.invalidate()    
  }
  </code></pre>