Here in the following code, a TableViewController is created and it's tableView and refreshControl properties are set. However even without adding the TableViewController as sub view to the View Controller view, the refresh control starts working. Was curious about how this is happening?
@IBOutlet weak var dashBoardTableView: UITableView!
let refreshControl = UIRefreshControl()
func configureRefreshControl()
{
refreshControl.addTarget(self, action: #selector(self.pullToRefresh) , for: .valueChanged)
//UIRefreshControl will not work properly without embedding it in a UITableViewController
let tableViewContainerVC = UITableViewController()
tableViewContainerVC.tableView = dashBoardTableView
tableViewContainerVC.refreshControl = refreshControl
}