{"id":13686013,"url":"https://github.com/morizotter/SwiftRefresher","last_synced_at":"2025-05-01T05:31:27.669Z","repository":{"id":62456681,"uuid":"48812658","full_name":"morizotter/SwiftRefresher","owner":"morizotter","description":"SwiftRefresher is one of the alternatives of UIRefreshControl.","archived":true,"fork":false,"pushed_at":"2017-03-03T17:03:53.000Z","size":2883,"stargazers_count":64,"open_issues_count":2,"forks_count":15,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T01:03:33.536Z","etag":null,"topics":["ios","uirefreshcontrol","uitableviewcontroller"],"latest_commit_sha":null,"homepage":"","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/morizotter.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":"2015-12-30T17:51:48.000Z","updated_at":"2023-01-28T00:34:41.000Z","dependencies_parsed_at":"2022-11-02T00:17:26.587Z","dependency_job_id":null,"html_url":"https://github.com/morizotter/SwiftRefresher","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/morizotter%2FSwiftRefresher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morizotter%2FSwiftRefresher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morizotter%2FSwiftRefresher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morizotter%2FSwiftRefresher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morizotter","download_url":"https://codeload.github.com/morizotter/SwiftRefresher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251830449,"owners_count":21650802,"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":["ios","uirefreshcontrol","uitableviewcontroller"],"created_at":"2024-08-02T14:01:01.382Z","updated_at":"2025-05-01T05:31:26.270Z","avatar_url":"https://github.com/morizotter.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# SwiftRefresher\n\n[![Version](https://img.shields.io/cocoapods/v/SwiftRefresher.svg?style=flat)](http://cocoadocs.org/docsets/SwiftRefresher) [![License](https://img.shields.io/cocoapods/l/SwiftRefresher.svg?style=flat)](http://cocoadocs.org/docsets/SwiftRefresher) [![Platform](https://img.shields.io/cocoapods/p/SwiftRefresher.svg?style=flat)](http://cocoadocs.org/docsets/SwiftRefresher)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/morizotter/SwiftRefresher)\n\n**SwiftRefresher** solves your problem on UIRefreshControl on UITableView in UIViewController!  **SwiftRefresher** is one of the alternatives of UIRefreshControl. Moreover, it is very customizable!\n\n![refresher.gif](refresher.gif)\n\n##Features\n\n- Simple and easy to use.\n- Customize loading view whatever you want.\n\n## Usage\n\n### Basic\n\nAdd codes below and add it to UITableView with `srf_addRefresher`. The closure will be called when refresh starts.\n\n```Swift\nlet refresher = RefresherView { [weak self] () -\u003e Void in\n    self?.updateItems()\n}\ntableView.srf_addRefresher(refresher)\n```\n\nAnd call `srf_endRefreshing()` whenever/wherever your refreshing task finished.\n\n```Swift\ns.tableView.srf_endRefreshing()\n```\n\n### Use with a little Customize\n\nThe view of SwiftRefresher is independent from its main system. The only requirement is to conform to `SwfitRefresherEventReceivable` protocol. Default view is `SimpleRefreshView`. You can use it with a little customization like this below:\n\n```Swift\nlet refresher = Refresher { [weak self] () -\u003e Void in\n    self?.updateItems()\n}\nrefresher.createCustomRefreshView { () -\u003e SwfitRefresherEventReceivable in\n    return SimpleRefreshView(activityIndicatorViewStyle: .White)\n}\ntableView.srf_addRefresher(refresher)\n```\n\nIn this example, I changed SimpleRefreshView's activityIndicatorViewStyle to .White. But you can customize more with create your own refreh view!\n\n### Customize!!!\n\nJust create a view with conforming to `SwfitRefresherEventReceivable`. `SwfitRefresherEventReceivable` has one required function `func didReceiveEvent(event: SwiftRefresherEvent)`. Through this function, refresher send the view the events. The events are below:\n\n```Swift\npublic enum SwiftRefresherEvent {\n    case Pull(offset: CGPoint, threshold: CGFloat)\n    case StartRefreshing\n    case EndRefreshing\n    case RecoveredToInitialState\n}\n```\n\nFor example, preset SimpleRefreshView has this easy codes.\n\n```Swift\npublic func didReceiveEvent(event: SwiftRefresherEvent) {\n    switch event {\n    case .Pull:\n        pullingImageView.hidden = false\n    case .StartRefreshing:\n        pullingImageView.hidden = true\n        activityIndicatorView.startAnimating()\n    case .EndRefreshing:\n        activityIndicatorView.stopAnimating()\n    case .RecoveredToInitialState:\n        break\n    }\n}\n```\n\n`RecoveredToInitialState` means that after EndRefreshing, the view will go back to initial state. And then the state becamed to the initial, this event will be called.\n\n##Runtime Requirements\n\n- iOS8.1 or later\n- Xcode 8.0 or later\n- Swift 3.0 or later\n\n## Installation and Setup\n\n### Installing with Carthage\n\nJust add to your Cartfile:\n\n```ogdl\ngithub \"morizotter/SwiftRefresher\"\n```\n\n###Installing with CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a centralised dependency manager that automates the process of adding libraries to your Cocoa application. You can install it with the following command:\n\n```bash\n$ gem update\n$ gem install cocoapods\n$ pods --version\n```\n\nTo integrate SwiftRefresher into your Xcode project using CocoaPods, specify it in your `Podfile` and run `pod install`.\n\n```bash\nplatform :ios, '8.1'\nuse_frameworks!\npod \"SwiftRefresher\", '~\u003e0.9.0'\n```\n\n### Manual Installation\n\nTo install SwiftRefresher without a dependency manager, please add all of the files in `/SwiftRefresher` to your Xcode Project.\n\n## Contribution\n\nPlease file issues or submit pull requests for anything you’d like to see! We're waiting! :)\n\n## License\nSwiftRefresher is released under the MIT license. Go read the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorizotter%2FSwiftRefresher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorizotter%2FSwiftRefresher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorizotter%2FSwiftRefresher/lists"}