title: Using selector for local function
body: <p>I want to set up a timer that would trigger some local function, so that count and scheduledAction() are not visible to outside. In the following case, scheduledAction is an unrecognized selector. What would be a good way to do this?</p>
  
  <pre><code>func SomeFunc() {
      var count = 0
      var timer = NSTimer.scheduledTimerWithTimeInterval(0.2, target: self, selector: "scheduledAction", userInfo: nil, repeats: true)
      func scheduledAction() {
          count++
          if count &lt; 10 {
              // do something
          }
          else {
              timer = nil
          }
      }
  }
  </code></pre>