Created
February 7, 2017 06:59
-
-
Save anuraagdjain/18b200b831f69c200f2ee5bb704cca60 to your computer and use it in GitHub Desktop.
Adding refresh for tableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Declare | |
| @IBOutlet weak var tableView:UITableView! | |
| var refreshControl = UIRefreshControl() | |
| //Adding in viewDidLoad() | |
| refreshControl.addTarget(self, action: #selector(ViewController.refreshEvents), for: .valueChanged) | |
| tableView.addSubView(refreshControl) | |
| //refreshEvents function | |
| func refreshEvents(){ | |
| /*Call method to fetch new data from server | |
| or do some logic. | |
| */ | |
| refreshControl.endRefreshing() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment