Skip to content

Instantly share code, notes, and snippets.

@jaisonv
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaisonv/a0f123d1200e7c99f305 to your computer and use it in GitHub Desktop.
Save jaisonv/a0f123d1200e7c99f305 to your computer and use it in GitHub Desktop.
Pull to refresh
// first enable "Refreshing" on controller via storyboard
override func viewDidLoad() {
super.viewDidLoad()
// the value for "action" must mach the function's name
refreshControl?.addTarget(self, action: "reloadStuff", forControlEvents: UIControlEvents.ValueChanged)
}
func reloadStuff() {
// reload data here
// then stop pull to refresh animation
self.refreshControl?.endRefreshing()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment