{"id":13719671,"url":"https://github.com/RxSwiftCommunity/RxPager","last_synced_at":"2025-05-07T11:32:34.427Z","repository":{"id":66314973,"uuid":"59175348","full_name":"RxSwiftCommunity/RxPager","owner":"RxSwiftCommunity","description":"Pager for RxSwift","archived":false,"fork":false,"pushed_at":"2022-09-05T07:29:18.000Z","size":386,"stargazers_count":60,"open_issues_count":4,"forks_count":19,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-29T06:32:22.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RxSwiftCommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-19T05:08:20.000Z","updated_at":"2023-04-03T10:13:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"80ee1fa1-c3a7-4fdd-951e-4da85cce5572","html_url":"https://github.com/RxSwiftCommunity/RxPager","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxPager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxPager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxPager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RxSwiftCommunity%2FRxPager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RxSwiftCommunity","download_url":"https://codeload.github.com/RxSwiftCommunity/RxPager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252869154,"owners_count":21816983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:00:53.961Z","updated_at":"2025-05-07T11:32:29.416Z","avatar_url":"https://github.com/RxSwiftCommunity.png","language":"Swift","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# RxPager\n\n[![CI Status](http://img.shields.io/travis/RxSwiftCommunity/RxPager.svg?style=flat)](https://travis-ci.org/RxSwiftCommunity/RxPager)\n[![Version](https://img.shields.io/cocoapods/v/RxPager.svg?style=flat)](http://cocoapods.org/pods/RxPager)\n[![License](https://img.shields.io/cocoapods/l/RxPager.svg?style=flat)](http://cocoapods.org/pods/RxPager)\n[![Platform](https://img.shields.io/cocoapods/p/RxPager.svg?style=flat)](http://cocoapods.org/pods/RxPager)\n\n## Usage\n\n```swift\n// MARK: Example 1\n\ntypealias Page = [Int]\ntypealias Callback = () -\u003e Void\n\n// take previous Page, and create next one\nlet nextPage = { (previousPage: Page?) -\u003e Observable\u003cPage\u003e in\nlet last = previousPage?.last ?? 0\nreturn Observable.just([last + 1, last + 2, last + 3])\n}\n\n// return true if there are more pages to be emitted\nlet hasNext = { (page: Page) -\u003e Bool in\nguard let last = page.last else { return true }\nreturn last \u003c 10 // arbitrary condition for the demo\n}\n\n// create the pager\nlet trigger = PublishSubject\u003cVoid\u003e()\nlet page$ = Observable.page(nextPage, while: hasNext, when: trigger)\nlet next = trigger.onNext\n\npage$.subscribe(onNext: { print($0) })\n// print [1, 2 ,3]\n\nnext() // print [4, 5, 6]\nnext() // print [7, 8, 9]\nnext() // print [10, 11, 12]\n\n// MARK: Example 2 (page from array)\n\nObservable\n.page(Array(1...10), by: 3, when: trigger)\n.subscribe(onNext: { print($0) })\n\n// print [1, 2 ,3]\nnext() // print [4, 5, 6]\nnext() // print [4, 5, 6]\nnext() // print [10]\n```\n\nSee [Demo](https://github.com/pgherveou/RxPager/blob/master/Example/RxPager/PagerTableViewController.swift) for more examples\n\n## Example\n\nTo run the example project, or run the playground, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n## Installation\n\nRxPager is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"RxPager\"\n```\n\n## Credits\nThis pod is inspired by inspired by @mttkay work https://gist.github.com/mttkay/24881a0ce986f6ec4b4d\nand was refactored using ideas discussed here https://github.com/RxSwiftCommunity/RxSwiftExt/issues/30\n\n## License\n\nRxPager is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRxSwiftCommunity%2FRxPager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRxSwiftCommunity%2FRxPager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRxSwiftCommunity%2FRxPager/lists"}