title: passing a closure to addTarget in Swift
body: <p>I have a method that gets movies from an api and then loads the data into the UITableView.  I want to reuse the network calls for a refresh control and at the end of the http get request, to call a completion handler that basically stops the refresh control once it's successful.  Is that possible?</p>
  
  <pre><code>func getMovies(completion: (() -&gt; ())?) {
      SVProgressHUD.show()
      Alamofire.request("https://api.moviesite").responseJSON {
          response in
          switch response.result {
          case .success(let data):
              if let json = data as? NSDictionary {
                  self.movieResults = json["results"] as! [NSDictionary]
                  self.nowPlayingTableView.reloadData()
              }
          case .failure(let error):
              print(error)
              self.showNetworkError(show: true)
          }
  
          SVProgressHUD.dismiss()
          if completion != nil {
              completion!()
          }
      }
  }
  </code></pre>
  
  <p>And when I use this method in viewDidLoad, I'd like to do something like this:</p>
  
  <pre><code>let refreshControl = UIRefreshControl()
          refreshControl.addTarget(self, action: #selector(NowPlayingViewController.getMovies(refreshControl.endRefreshing)), for: .valueChanged)
          nowPlayingTableView.insertSubview(refreshControl, at: 0)
  </code></pre>
  
  <p>but I get a compiler error about </p>
  
  <p>getMovies cannot be used, did you mean to use a value type instead?</p>