Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shial4/scountlabel
SCountLabel is an easy to use Swift extension counter for UILabel
https://github.com/shial4/scountlabel
animation counter swift uikit uilabel uilabel-extension
Last synced: 2 months ago
JSON representation
SCountLabel is an easy to use Swift extension counter for UILabel
- Host: GitHub
- URL: https://github.com/shial4/scountlabel
- Owner: shial4
- License: mit
- Created: 2017-06-09T04:10:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-26T04:21:36.000Z (almost 6 years ago)
- Last Synced: 2024-10-28T21:12:14.609Z (3 months ago)
- Topics: animation, counter, swift, uikit, uilabel, uilabel-extension
- Language: Swift
- Size: 66.4 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SCountLabel
SCountLabel is an easy to use Swift extension counter for UILabel. There is no need to use custom class for your labels. :)
## 💊 Usage
You can count integer or floatingpoints values
```swift
UILabel().count(to: "11")
```
![int](https://github.com/shial4/SCountLabel/blob/master/Media/int.gif "int")```swift
UILabel().count(to: "11.0")
```
![float](https://github.com/shial4/SCountLabel/blob/master/Media/float.gif "float")You can have multiple variaitons including few counting numbers in same string.
```swift
UILabel().count(to: "11 and second number in same string -22.0")
```
The values can be negative or positive. Typed as `2.0` or `.2` what ever you like!
More over you can pass your own time interval between value changes in your string
```swift
UILabel().count(from: "down 11.0 up 7", to: "down 5.0 up 11", interval: 0.2)
```
For those who likes to play with strings format. Is it as well awaiable to modife for each number format passing it in array.
Remember the format array have to be the sime element count as the shortest strings `from` or `to` number count. And the format need to be specify for float values which means `"%f"`, ex:`"%.2f"` or `"%0.2f %%"` or any custom format you wont to add.
```swift
UILabel().count(from: "down 11.0 up 7", to: "down 5.0 up 11", format: ["%0.2f", "%0.0f"])
```
![custom](https://github.com/shial4/SCountLabel/blob/master/Media/custom.gif "custom")Full example:
```swift
UILabel().count(from: "down 11.0 up 7", to: "down 5.0 up 11", interval: 0.2, format: ["%0.2f", "%0.0f"])
```## 🔧 Installation
**CocoaPods:**
Add the line `pod "SCountLabel"` to your `Podfile`
**Carthage:**
Add the line `github "shial4/SCountLabel"` to your `Cartfile`
**Manual:**
Clone the repo and drag the file `SCountLabel.swift` into your Xcode project.
**Swift Package Manager:**
Add the line `.Package(url: "https://github.com/shial4/SCountLabel.git", majorVersion: 0, minor: 0)` to your `Package.swift`
## ⭐ Contributing
Be welcome to contribute to this project! :)
## ❓ Questions
Just create an issue on GitHub.
## 📝 License
This project was released under the [MIT](LICENSE) license.