Last active
July 2, 2019 06:26
-
-
Save ssebi/4ff1d89fa7966639469ff691f4b452df to your computer and use it in GitHub Desktop.
Extension to scroll a UIScrollView to top
This file contains 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
extension UIScrollView { | |
func scrollToTop(animated: Bool) { | |
let topOffset = CGPoint(x: 0, y: -contentInset.top) | |
setContentOffset(topOffset, animated: animated) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment