{"id":18683776,"url":"https://github.com/efprefix/efcountinglabel","last_synced_at":"2025-05-15T08:09:19.694Z","repository":{"id":30360366,"uuid":"33912866","full_name":"EFPrefix/EFCountingLabel","owner":"EFPrefix","description":"Adds animated counting support to UILabel.","archived":false,"fork":false,"pushed_at":"2025-02-16T19:33:48.000Z","size":2940,"stargazers_count":502,"open_issues_count":3,"forks_count":63,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-04T21:10:05.822Z","etag":null,"topics":["button","cocoapods","count","countdown","counting","countinglabel","ios","label","number","swift","uicountinglabel"],"latest_commit_sha":null,"homepage":"https://swiftpackageindex.com/EFPrefix/EFCountingLabel","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/EFPrefix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2015-04-14T05:36:59.000Z","updated_at":"2025-02-24T09:10:58.000Z","dependencies_parsed_at":"2025-02-26T21:00:22.280Z","dependency_job_id":"7b6164ac-778a-4b78-a131-526840007659","html_url":"https://github.com/EFPrefix/EFCountingLabel","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFCountingLabel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFCountingLabel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFCountingLabel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFCountingLabel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EFPrefix","download_url":"https://codeload.github.com/EFPrefix/EFCountingLabel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166865,"owners_count":21058481,"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":["button","cocoapods","count","countdown","counting","countinglabel","ios","label","number","swift","uicountinglabel"],"created_at":"2024-11-07T10:15:42.647Z","updated_at":"2025-04-10T06:20:01.905Z","avatar_url":"https://github.com/EFPrefix.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://raw.githubusercontent.com/EFPrefix/EFCountingLabel/master/Assets/EFCountingLabel.png)\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://travis-ci.org/EFPrefix/EFCountingLabel\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/travis/EFPrefix/EFCountingLabel.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://swiftpackageindex.com/EFPrefix/EFCountingLabel\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/SPM-ready-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/EFCountingLabel\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/v/EFCountingLabel.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/EFCountingLabel\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/p/EFCountingLabel.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/badge/language-swift-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://raw.githubusercontent.com/EFPrefix/EFCountingLabel/master/LICENSE\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/l/EFCountingLabel.svg?style=flat\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nA label which can show number change animated in Swift, inspired by [UICountingLabel](https://github.com/dataxpress/UICountingLabel).\n\n\u003e [中文介绍](https://github.com/EFPrefix/EFCountingLabel/blob/master/README_CN.md)\n\n## Overview\n\n\u003cimg src=\"https://raw.githubusercontent.com/EFPrefix/EFCountingLabel/master/Assets/example.gif\" width = \"35%\"/\u003e\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n- Xcode 16+\n- Swift 6.0+\n\n## Installation\n\n### CocoaPods\n\nEFCountingLabel is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\npod 'EFCountingLabel'\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.\n\nOnce you have your Swift package set up, adding EFCountingLabel as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/EFPrefix/EFCountingLabel.git\", .upToNextMinor(from: \"6.0.0.0\"))\n]\n```\n\n## Setup\n\nSimply initialize a `EFCountingLabel` the same way you set up a regular `UILabel`:\n\n```swift\nlet myLabel = EFCountingLabel(frame: CGRect(x: 10, y: 10, width: 200, height: 40))\nself.view.addSubview(myLabel)\n```\n\nYou can also add it to your `xib` or `storyboard` , just make sure you set the class and module to `EFCountingLabel`.\n\n\u003cimg src=\"https://raw.githubusercontent.com/EFPrefix/EFCountingLabel/master/Assets/storyboard.png\"/\u003e\n\n### Use\n\nSet the format of your label. This will be filled with string (depending on how you format it) when it updates, you can provide a `formatBlock`, which permits greate control over how the text is formatted. If not provided, the default format will be `\"%d\"`:\n\n```swift\nmyLabel.setUpdateBlock { value, label in\n    label.text = String(format: \"%.2f%%\", value)\n}\n```\n\nOptionally, set the timing function. The default is `EFTimingFunction.linear`, which will not change speed until it reaches the end. Other options are described below in the Methods section.\n\n```swift\nmyLabel.counter.timingFunction = EFTimingFunction.easeOut(easingRate: 3)\n```\n\nWhen you want the label to start counting, just call:\n\n```swift\nmyLabel.countFrom(5, to: 100)\n```\n\nYou can also specify the duration. The default is 2.0 seconds.\n\n```swift\nmyLabel.countFrom(1, to: 10, withDuration: 3.0)\n```\n\nYou can use common convinient methods for counting, such as:\n\n```swift\nmyLabel.countFromCurrentValueTo(100)\nmyLabel.countFromZeroTo(100)\n```\n\nBehind the scenes, these convinient methods use one base method, which has the following full signature:\n\n```swift\nmyLabel.countFrom(startValue: CGFloat, to: CGFloat, withDuration: TimeInterval)\n```\n\nYou can get current value of your label using `currentValue` method (works correctly in the process of animation too):\n\n```swift\nlet currentValue: CGFloat = myLabel.counter.currentValue\n```\n\nOptionally, you can specify a `completionBlock` to perform an acton when the label has finished counting:\n\n```swift\nmyLabel.completionBlock = { () in\n    print(\"finish\")\n}\n```\n\n### Modes\n\nThere are currently four modes of counting.\n\n- EFTimingFunction.linear: Counts linearly from the start to the end;\n- EFTimingFunction.easeIn: Ease In starts out slow and speeds up counting as it gets to the end, stopping suddenly at the final value;\n- EFTimingFunction.easeOut: Ease Out starts out fast and slows down as it gets to the destination value;\n- EFTimingFunction.easeInOut: Ease In/Out starts out slow, speeds up towards the middle, and then slows down as it approaches the destination. It is a nice, smooth curve that looks great, and is the default method;\n- EFTimingFunction.easeInBounce;\n- EFTimingFunction.easeOutBounce.\n\n## Author\n\nEyreFree, eyrefree@eyrefree.org\n\n## License\n\n![](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/License_icon-mit-88x31-2.svg/128px-License_icon-mit-88x31-2.svg.png)\n\nEFCountingLabel 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%2Fefprefix%2Fefcountinglabel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefprefix%2Fefcountinglabel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefprefix%2Fefcountinglabel/lists"}