     
     var selectedMovie = NSDictionary()
     
+    let refreshControl = UIRefreshControl()
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         
         // Do any additional setup after loading the view.
         movieTable.delegate = self
         movieTable.dataSource = self
-        
+        setupRefreshControl()
         self.loadJsonData()
+
     }
     
     override func didReceiveMemoryWarning() {

        
    }
    
    private func loadJsonData() {
        let apiKey = "a07e22bc18f5cb106bfe4cc1f83ad8ed"
        let url = URL(string: "https://api.themoviedb.org/3/movie/now_playing?api_key=\(apiKey)")
        let request = URLRequest(

                                        print("response: \(responseDictionary)")
                                        self.movieData = responseDictionary["results"] as! [NSDictionary]
                                        self.movieTable.reloadData()
                                        self.refreshControl.endRefreshing()
                                        
                                    }
                                }
            })
        task.resume()
    }
    
    func setupRefreshControl() {
        //refreshControl = UIRefreshControl()
        refreshControl.addTarget(self, action: #selector(MoviesViewController.loadJsonData), for: UIControlEvents.valueChanged)
        movieTable.insertSubview(refreshControl, at: 0)
    }
    
}
