{"id":18479205,"url":"https://github.com/kevinzhourafael/figrefresh","last_synced_at":"2025-05-13T18:41:25.918Z","repository":{"id":56911236,"uuid":"205543748","full_name":"KevinZhouRafael/FigRefresh","owner":"KevinZhouRafael","description":"FigRefresh is a Swift refresh framework. It's api looks like MJRefresh. FigRefresh is simple and extensibility.","archived":false,"fork":false,"pushed_at":"2019-08-31T18:31:23.000Z","size":1612,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-26T05:54:17.315Z","etag":null,"topics":["ios","mjrefresh","mjrefresh-swift","refresh","refreshfooter","refreshheader","swift","swift-refresh-framework"],"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/KevinZhouRafael.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-08-31T12:49:19.000Z","updated_at":"2019-09-20T07:02:07.000Z","dependencies_parsed_at":"2022-08-20T20:20:34.480Z","dependency_job_id":null,"html_url":"https://github.com/KevinZhouRafael/FigRefresh","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FFigRefresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FFigRefresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FFigRefresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FFigRefresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinZhouRafael","download_url":"https://codeload.github.com/KevinZhouRafael/FigRefresh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254005902,"owners_count":21998341,"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","mjrefresh","mjrefresh-swift","refresh","refreshfooter","refreshheader","swift","swift-refresh-framework"],"created_at":"2024-11-06T12:13:47.588Z","updated_at":"2025-05-13T18:41:25.854Z","avatar_url":"https://github.com/KevinZhouRafael.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FigRefresh\n\n[![Version](https://img.shields.io/cocoapods/v/FigRefresh.svg?style=flat)](http://cocoapods.org/pods/FigRefresh)\n[![License](https://img.shields.io/cocoapods/l/FigRefresh.svg?style=flat)](http://cocoapods.org/pods/FigRefresh)\n[![Platform](https://img.shields.io/cocoapods/p/FigRefresh.svg?style=flat)](http://cocoapods.org/pods/FigRefresh)\n\n\nFigRefresh is a Swift refresh framework. It's api looks like [MJRefresh](https://github.com/CoderMJLee/MJRefresh). FigRefresh is simple and extensibility.\n\n[**中文版**](README_cn.md)\n\n![](git.gif)\n\n## Usage\n\n```swift\nimport FigRefresh\n\n scrollView.fig_header = RefreshIndicatorHeader(refreshingClosure: { [weak self] in\n     DispatchQueue.global().async {\n        sleep(3)\n        DispatchQueue.main.async {\n            self?.scrollView.fig_header?.endRefreshing()\n        }\n    }\n })\n\n```\nlook up FigRefreshDemo project in sources. \n\n## Design\n\n\n![](img_en.jpeg)\n\n\nRefreshComponent have a titleLabel property，it use show different text on various states.\nI suggest you custom titleLabel in it's sub classes.\n\nI support 3 types implements:\n\n- 1、Text. \n- 2、Indicator + Text. \n- 3、Images + Text. \n\nIf these can't satisfy you，Just inherit RefreshHeader and RefreshFooter class. \n\n```Swift\n\npublic class MyCustomHeader:RefreshHeader{\n    \n    //Custom UI\n    var myImage:UIImageView?\n    var myDetailsLabel:UILabel?\n    ...\n\n\n\t//Return height of UI. 50 is default value\n    public override func refreshComponentHeight() -\u003e CGFloat {\n        return 50\n    }\n    \n    //Just excute once. This method used to init UI. \n    public override func refreshComponentDidMoveToSuperview() {\n        //must call\n        super.refreshComponentDidMoveToSuperview()\n        \n        //Custom styles of myImage\n        //Add myImage\n        addSubview(myImage)\n        //Layout myImage\n        ...\n        \n        //Custom styles of myDetailsLabel\n        //Add myDetailsLabel\n        addSubview(myDetailsLabel)\n        //Layout myDetailsLabel\n        ...\n        \n        //If you meed custom titleLabel\n        titleLabel?.textColor = UIColor.gray\n        titleLabel?.textAlignment = .left\n        titleLabel!.font = UIFont.systemFont(ofSize: 13)\n        \n        //Option1: Layout titleLabel use constraints\n//        titleLabel?.snp.remakeConstraints({ (make) in\n//            make.left.equalTo(animationIV.snp.right).offset(10)\n//            make.centerY.equalToSuperview()\n//            make.height.equalToSuperview()\n//            make.right.equalToSuperview()\n//        })\n\n        //Option2: Layout titleLabel use frame\n        titleLabel?.frame = CGRect(x: animationIV.frame.maxX + 10, y: 0, width: frame.width - (animationIV.frame.maxX + 10), height: height)\n        \n        ...\n        \n    }\n\n    \n    public override  func refreshComponentStateChange(state: RefreshState) {\n        super.refreshComponentStateChange(state: state)\n        switch state{\n        case .refreshing:  //custom style on refreshing state\n            ...\n            break\n        default:   //custom style on idle state\n            ...\n            break\n        }\n        \n    }\n    \n}\n\n```\n\n## States\n\nFigRefresh have 6 states:\n\n- idle: normal idel\n- pullingInRect: pulling and component not displays fully\n- pullingOutRect: pulling and component displays fully\n- releaseing: Releaseing, not refreshing, from pullingInRect state.\n- refreshing: Releaseing, and refreshing, from pullingOutRect state.\n- noMoreData: no more date(only footer)\n\n    \nRefreshHeader and RefreshFooter classes，support default text on states：\n\n```Swift\n\nopen class RefreshHeader:RefreshHeaderControl{\n\n\t...\n\t    \n    open override func refreshComponentTitlesWithStates() -\u003e [RefreshState : String] {\n          return [.idle:\"Pull down to refresh\",\n                 .pullingInRect:\"Pull down to refresh\",\n                 .pullingOutRect:\"Release to refresh\",\n                 .releaseing:\"Pull down to refresh\",\n                 .refreshing:\"Loading...\"]\n    }\n    \n}\n```\n\n```Swift\n\nopen class RefreshFooter:RefreshFooterControl{\n\n\t...\n\t    \n    open override func refreshComponentTitlesWithStates() -\u003e [RefreshState : String] {\n        return [.idle: \"Pull up to load more\",\n                .pullingInRect: \"Pull up to load more\",\n                .pullingOutRect: \"Release to load more\",\n                .releaseing:\"Pull up to load more\",\n                .refreshing:\"Loading...\",\n                .noMoreData:\"No more data\"]\n    }\n    \n}\n\n\n```\n\n## Best Practices\n\n### 1 、Inherit RefreshHeader and RefreshFooter.\n- 1、Add new proterties.\n- 1、Override refreshComponentTitlesWithStates method to custom text.\n- 2、Override refreshComponentDidMoveToSuperview method to custom UI.\n\n### 2、Set Globle Header and Footer. \n\nSet onec Header and Footer. \n\n```Swift\n        \nFigRefreshSetDefaultHeader(MyCustomRefreshHeader.self)\nFigRefreshSetDefaultFooter(MyCustomRefreshFooter.self)\n        \n```\n \n call header use fig_header.\n call footer use fig_footer.\n \n```Swift\n\nscrollView.fig_header {\n    DispatchQueue.global().async {  [weak self] in\n        sleep(3)\n        DispatchQueue.main.async {\n            self?.scrollView.fig_header?.endRefreshing()\n        }\n    }\n}\nscrollView.fig_footer { [weak self] in\n    DispatchQueue.global().async {\n        sleep(3)\n        DispatchQueue.main.async {\n            self?.scrollView.fig_footer?.endRefreshing()\n        }\n    }\n}\n\n```\n\n### 3 、Dynimic modify Header and Footer. \n\n```Swift\n\ntableView.fig_footer?.setTitle(\"xxxx\", for: .noMoreData) // If needed.\ntableView.fig_footer?.endRefreshingWithNoMoreData()\n\n```\n\n### 4、use custom header or footer diffent with globles.\n\n```Swift\n scrollView.fig_header = MyCustom2Header(refreshingClosure: { [weak self] in\n     DispatchQueue.global().async {\n        sleep(3)\n        DispatchQueue.main.async {\n            self?.scrollView.fig_header?.endRefreshing()\n        }\n    }\n })\n\n```\n\n## Requirements\n- iOS 8.0+  \n- Xcode 10.2\n- Swift 5\n\n## Installation\n\n### Cocoapods\n\nAdd the following line to your Podfile:\n\n```ruby\npod \"FigRefresh\"\n```\n\n## Author\n\nKevin Zhou\n\n- 邮件: \u003cwumingapie@gmail.com\u003e\n- **Twitter**: [**@wumingapie**](https://twitter.com/wumingapie)\n- **Facebook**: [**wumingapie**](https://www.facebook.com/wumingapie)\n- **LinkedIn**: [**Rafael**](https://www.linkedin.com/in/rafael-zhou-7230943a/)\n\n## License\n\nFigRefresh 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%2Fkevinzhourafael%2Ffigrefresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinzhourafael%2Ffigrefresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinzhourafael%2Ffigrefresh/lists"}