{"id":18357026,"url":"https://github.com/gumob/rxpulltorefresh","last_synced_at":"2025-10-04T14:21:51.503Z","repository":{"id":62453175,"uuid":"164059453","full_name":"gumob/RxPullToRefresh","owner":"gumob","description":" A Swift library allows you to create a flexibly customizable pull-to-refresh view supporting RxSwift.","archived":false,"fork":false,"pushed_at":"2020-06-24T05:57:20.000Z","size":2506,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T00:34:01.241Z","etag":null,"topics":["animation","ios","pull-to-refresh","pulltorefresh","rxswift","swift"],"latest_commit_sha":null,"homepage":"https://gumob.github.io/RxPullToRefresh/index.html","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/gumob.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}},"created_at":"2019-01-04T04:52:40.000Z","updated_at":"2024-09-11T10:49:16.000Z","dependencies_parsed_at":"2022-11-01T23:46:44.372Z","dependency_job_id":null,"html_url":"https://github.com/gumob/RxPullToRefresh","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gumob%2FRxPullToRefresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gumob%2FRxPullToRefresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gumob%2FRxPullToRefresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gumob%2FRxPullToRefresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gumob","download_url":"https://codeload.github.com/gumob/RxPullToRefresh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247484495,"owners_count":20946388,"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":["animation","ios","pull-to-refresh","pulltorefresh","rxswift","swift"],"created_at":"2024-11-05T22:12:35.458Z","updated_at":"2025-10-04T14:21:46.457Z","avatar_url":"https://github.com/gumob.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/gumob/RxPullToRefresh)\n[![Version](http://img.shields.io/cocoapods/v/RxPullToRefresh.svg)](http://cocoadocs.org/docsets/RxPullToRefresh)\n[![Platform](http://img.shields.io/cocoapods/p/RxPullToRefresh.svg)](http://cocoadocs.org/docsets/RxPullToRefresh)\n[![Build Status](https://travis-ci.com/gumob/RxPullToRefresh.svg?branch=master)](https://travis-ci.com/gumob/RxPullToRefresh)\n[![codecov](https://codecov.io/gh/gumob/RxPullToRefresh/branch/master/graph/badge.svg)](https://codecov.io/gh/gumob/RxPullToRefresh)\n[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)\n![Language](https://img.shields.io/badge/Language-Swift%204.2-orange.svg)\n![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg)\n\n# RxPullToRefresh\nA Swift library allows you to create a flexibly customizable pull-to-refresh view supporting RxSwift.\n\n\u003cimg src=\"https://raw.githubusercontent.com/gumob/RxPullToRefresh/master/Metadata/screenshot-animation.gif\" alt=\"drawing\" width=\"240px\" style=\"width:240px;\"/\u003e\n\n## Features\n\n- Support UIScrollView, UITableView, and UICollectionView\n- Customizable refresh view\n- Customizable animaton options\n- Configurable option whether to load while dragging or to load after an user release a finger\n- Error handling\n- Support RxSwift/RxCocoa\n\n## Requirements\n\n- iOS 10.0 or later\n- Swift 5.0 or later\n\n## Installation\n\n### Carthage\n\nAdd the following to your `Cartfile` and follow [these instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application).\n\n```\ngithub \"gumob/RxPullToRefresh\"        # Swift 5.0\ngithub \"gumob/RxPullToRefresh\" ~\u003e 1.0 # Swift 5.0\ngithub \"gumob/RxPullToRefresh\" ~\u003e 0.1 # Swift 4.2\n```\n\nDo not forget to include RxSwift.framework and RxCocoa.framework. Otherwise it will fail to build the application.\u003cbr/\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/gumob/RxPullToRefresh/master/Metadata/carthage-xcode-config.jpg\" alt=\"drawing\" width=\"480\" style=\"width:100%; max-width: 480px;\"/\u003e\n\n### CocoaPods\n\nTo integrate RxPullToRefresh into your project, add the following to your `Podfile`.\n\n```ruby\nplatform :ios, '10.0'\nuse_frameworks!\n\npod 'RxPullToRefresh', '~\u003e 1.0'   # Swift 5.0\npod 'RxPullToRefresh', '~\u003e 0.1'   # Swift 4.2\n```\n\n## Usage\n\nRead the [API reference](https://gumob.github.io/RxPullToRefresh/Classes/RxPullToRefresh.html) and the [USAGE.md](https://gumob.github.io/RxPullToRefresh/usage.html) for detailed information.\n\n### Basic Usage\n\n#### Import frameworks to your project\n\n```swift\nimport RxSwift\nimport RxCocoa\nimport RxPullToRefresh\n```\n\n#### Add RxPullToRefresh\n\nCreate a RxPullToRefresh object.\n\n```swift\n// Create a RxPullToRefresh object\nself.topPullToRefresh = RxPullToRefresh(position: .top)\n// Add a RxPullToRefresh object to UITableView\nself.tableView.p2r.addPullToRefresh(self.topPullToRefresh)\n```\n\n#### Observe RxPullToRefreshDelegate\n\nBy observing [RxPullToRefreshDelegate](https://gumob.github.io/RxPullToRefresh/Protocols/RxPullToRefreshDelegate.html), you can watch the state of a RxPullToRefresh object. This delegate is get called by the RxPullToRefresh object every time its [state](https://gumob.github.io/RxPullToRefresh/Enums/RxPullToRefreshState.html) or scrolling rate is changed.\n```swift\n// Observe RxPullToRefreshDelegate\nself.topPullToRefresh.rx.action\n        .subscribe(onNext: { [weak self] (state: RxPullToRefreshState, progress: CGFloat, scroll: CGFloat) in\n            // Send request if RxPullToRefreshState is changed to .loading\n            switch state {\n            case .loading: self?.prepend()\n            default:       break\n            }\n        })\n        .disposed(by: self.disposeBag)\n```\n\n#### Load and append contents\n\n```swift\nself.viewModel.prepend()\n              .subscribe(onSuccess: { [weak self] in\n                  // Successfully loaded, collapse refresh view immediately\n                  self?.tableView.p2r.endRefreshing(at: .top)\n              }, onError: { [weak self] (_: Error) in\n                  // Failed to load, show error\n                  self?.tableView.p2r.failRefreshing(at: .top)\n              })\n              .disposed(by: self.disposeBag)\n```\n\n#### Disable refreshing by binding Boolean value to canLoadMore property\n\n```swift\nself.viewModel.canPrepend\n        .asDriver()\n        .drive(self.topPullToRefresh.rx.canLoadMore)\n        .disposed(by: self.disposeBag)\n```\n\n#### Dispose RxPullToRefresh objects\n\n```swift\noverride func viewDidDisappear(_ animated: Bool) {\n    super.viewDidDisappear(animated)\n    self.tableView.p2r.endAllRefreshing()\n    self.tableView.p2r.removeAllPullToRefresh()\n}\n```\n\n### Advanced Usage\n\n#### About the example project\n\n`RxPullToRefresh` allows you flexibly customize a refresh view by inheriting [RxPullToRefresh](https://gumob.github.io/RxPullToRefresh/Classes/RxPullToRefresh.html) and [RxPullToRefreshView](https://gumob.github.io/RxPullToRefresh/Classes/RxPullToRefreshView.html) classes. Please check [example sources](https://github.com/gumob/RxPullToRefresh/blob/master/Example/) for advanced usage.\n\n- [CustomRefresh](https://github.com/gumob/RxPullToRefresh/blob/master/Example/CustomRefresh.swift): A class inheriting from `RxPullToRefresh`.\n- [CustomRefreshView](https://github.com/gumob/RxPullToRefresh/blob/master/Example/CustomRefresh.swift): A class inheriting from `RxPullToRefreshView`. Animation logics are implemented in this class.\n- [BaseTableViewController](https://github.com/gumob/RxPullToRefresh/blob/master/Example/TableViewController.swift): A view controller that conforms to MVVM architecture.\n- [CustomTableViewController](https://github.com/gumob/RxPullToRefresh/blob/master/Example/TableViewController.swift): A view controller that creates a `CustomPullToRefresh` instance.\n- [TableViewModel](https://github.com/gumob/RxPullToRefresh/blob/master/Example/TableViewModel.swift): A view model that manipulates data sources.\n\n#### Build the example app\n\n1. Update Carthage frameworks\n```bash\n$ carthage update --platform iOS\n```\n2. Open `RxPullToRefresh.xcodeproj`\n3. Select the scheme `RxPullToRefreshExample` from the drop-down menu in the upper left of the Xcode window\n4. Press ⌘R\n\n\n## Copyright\n\nRxPullToRefresh is released under MIT license, which means you can modify it, redistribute it or use it however you like.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgumob%2Frxpulltorefresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgumob%2Frxpulltorefresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgumob%2Frxpulltorefresh/lists"}