Created
August 13, 2018 22:12
-
-
Save Arrlindii/404f535ed730ef5eaf9931ef79e9a301 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 loadNextPageObservable() -> Observable<Void> { | |
| return rx.contentOffset | |
| .skipWhile { | |
| $0.y < self.frame.size.height | |
| }.map { contentOffset -> Bool in | |
| let padding = CGFloat(20.0) | |
| return contentOffset.y + self.frame.size.height + padding > self.contentSize.height | |
| }.distinctUntilChanged().map { shouldLoad in | |
| if shouldLoad { | |
| Void() | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment