Juanpe/Counter is a mobile-focused project on GitHub with 53 stars, written primarily in Swift. Counter is powerful and multipurpose counter
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
If you prefer, you can integrate Counter into your project manually. Simply add the Counter.swift source file directly into your project.
🐒 How to use
Import Counter in proper place.
import Counter
Now, you only need to create a Counter instance and start to play 🙂
let counter = Counter() // 0
counter.increment() // 1
You can specify how many units you want increment the counter
counter.increment(2) // 3
Also you can decrement the count
counter.decrement() // 2
And of course you can reset the counter
counter.reset() // 0
Other powerful feature is that you can sum various values at the same time
counter.sum(countables: 2, 3, -1) // 4
🤓 Advanced
Can use your own objects to increment the counter. Only need implement Countable protocol:
protocol Countable {
var deltaValue: Int { get }
}
Example:
struct Person {
var age: Int
}
extension Person: Countable{
var deltaValue: Int {
return self.age
}
}
let dad = Person(age: 45)
let mum = Person(age: 40)
let son = Person(age: 25)
let ageCounter = Counter()
ageCounter.increment(dad)
ageCounter.increment(mum)
ageCounter.increment(son)
print(ageCounter.currentValue) // 110
// Also you can use `sum` method or static method
ageCounter.sum(countables:dad, mum, son) // 110
let ages = Counter.sum(countables:dad, mum, son) // 110
🔔 Milestones
Sometimes you need to know when a counter has reached or will reach a value. With Counter will be a piece of cake.
You only need to add milestones and conform to CounterDelegate protocol. Then, your counter will notify you before reaching and when it reaches each previously defined milestone.
This is an open source project, so feel free to contribute. How?
Open an issue.
Send feedback via email.
Propose your own fixes, suggestions and open a pull request with the changes.
See all contributors
👨🏻💻 Author
Juanpe Catalán
👮🏻 License
MIT License
Copyright (c) 2017 Juanpe Catalán
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The most recent commit recorded on Juanpe/Counter was 8.8 years ago, based on the GitHub push timestamp. The repository has 5 forks — one of the better signals of community interest.
How does Juanpe/Counter compare to other Mobile projects?
Juanpe/Counter is tracked by TopGit in the Mobile category, with 53 GitHub stars and written in Swift. Browse the Mobile topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does Juanpe/Counter have?
Juanpe/Counter has 53 GitHub stars — refresh the page for the live number, or check github.com/Juanpe/Counter. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is Juanpe/Counter open source?
Yes — Juanpe/Counter ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/Juanpe/Counter.
What is Juanpe/Counter?
Juanpe/Counter (Juanpe/Counter) is a Swift project on GitHub. From the project's own README: Counter is powerful and multipurpose counter
Where do I read more about Juanpe/Counter?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/Juanpe/Counter is the definitive source.
Read full README in the tab above.
Want a second opinion on Counter?
Ask an AI that can read this page — one click and you get its take on Counter.