You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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()
}
The text was updated successfully, but these errors were encountered:
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
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 ofincrement
. Example:Compare their implementations to each other.
increment
:setCount
:The text was updated successfully, but these errors were encountered: