Created
February 9, 2023 23:22
-
-
Save noppefoxwolf/4db73a43a83f4a96bddef8b57a95a7a1 to your computer and use it in GitHub Desktop.
simulate statusbar action.
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 UIWindowScene { | |
func scrollToTop() { | |
guard let window = keyWindow else { return } | |
var nextResponder: UIResponder? = window.hitTest(window.center, with: UIEvent()) | |
while let responder = nextResponder?.next { | |
if let scrollView = responder as? UIScrollView { | |
scrollView.setContentOffset(.zero, animated: true) | |
} | |
nextResponder = responder | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment