Search code examples
swiftxcodescrollview

Is there a quick way to programatically scroll to top of scrollView? (Xcode)


Basically, I want the scrollView to get back to the very top after an action has been made, let's say after a button press. I have looked for a proper answer, but can only find solutions in other languages, including objective-c. Is there a method to call or do I have to program and call a custom code snippet?


Solution

  • scrollView.contentOffset = .zero