Merge pull request #2 from TouchInstinct/block_minimum_reached

Added block call when minimum is reached
This commit is contained in:
Даша 2019-03-11 16:14:38 +03:00 committed by GitHub
commit d7c8bb83b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -111,7 +111,10 @@ import UIKit
/// Label tap closure
@objc public var didTouchLabel: ((Double) -> Void)?
/// Block is called when the minimum is exceeded
@objc public var minimumExceeded: (() -> Void)?
/// Text color of the middle label. Defaults to white.
@objc @IBInspectable public var labelTextColor: UIColor = UIColor.white {
didSet {
@ -439,6 +442,7 @@ extension GMStepper {
if value == minimumValue {
animateLimitHitIfNeeded()
minimumExceeded?()
} else {
stepperState = .ShouldDecrease
animateSlideLeft()
@ -529,12 +533,11 @@ private extension GMStepper {
func handleIsLimitReached() {
let isLimitReached = value == minimumValue
leftButton.alpha = isLimitReached ? leftButtonLimitOpacity : 1
leftButton.isUserInteractionEnabled = !isLimitReached
}
}
extension Decimal {
var significantFractionalDecimalDigits: Int {
return max(-exponent, 0)
}