Skip to content

Instantly share code, notes, and snippets.

@Heilum
Created July 13, 2020 09:53
Show Gist options
  • Save Heilum/abb558e6ef25dd54599dbb243f749ece to your computer and use it in GitHub Desktop.
Save Heilum/abb558e6ef25dd54599dbb243f749ece to your computer and use it in GitHub Desktop.
import UIKit
extension UIRefreshControl {
func beginRefreshingManually(_ tintColor:UIColor) {
self.tintColor = tintColor
if let scrollView = superview as? UIScrollView {
scrollView.setContentOffset(CGPoint(x: 0, y:scrollView.contentOffset.y - frame.height), animated: false)
}
beginRefreshing()
self.sendActions(for: .valueChanged)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment