Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxCount is not taken into account when calling the increment method #26

Open
oleg-samoylov-ext-orion opened this issue Jun 17, 2022 · 1 comment

Comments

@oleg-samoylov-ext-orion

Hello everybody!

I've found out that maxCount is taken into account only when we call the setCount method, unfortunately, this constant doesn't apply for calls of increment. Example:

hub.setMaxCount(99)
hub.increment(by: 150)
// count == 150

Compare their implementations to each other. increment:

    /// Increases count by 1
    public func increment() {
        increment(by: 1)
    }
    
    /// Increases count by amount.
    /// - Parameter amount: Increment count.
    public func increment(by amount: Int) {
        count += amount
    }

setCount:

    /// Set the count yourself.
    /// - Parameter newCount: New count to be set to badge.
    public func setCount(_ newCount: Int) {
        self.count = newCount
        let labelText = count > maxCount ? "\(maxCount)+" : "\(count)"
        countLabel?.text = labelText
        checkZero()
    }
@oleg-samoylov-ext-orion oleg-samoylov-ext-orion changed the title maxCount isn not taken into account when calling the increment method maxCount is not taken into account when calling the increment method Jun 17, 2022
@wonder2011
Copy link

wonder2011 commented Feb 23, 2023

What about this issue ?, I need this too. Please @jogendra help with this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants