@@ -96,6 +96,9 @@ import UIKit
96 private let labelSlideLength: CGFloat = 5
96 private let labelSlideLength: CGFloat = 5
97 private let labelSlideDuration: NSTimeInterval = 0.1
97 private let labelSlideDuration: NSTimeInterval = 0.1
99+ private let limitHitAnimationDuration: NSTimeInterval = 0.1
100+ @IBInspectable public var limitHitAnimationColor: UIColor = UIColor(red:0.23, green:0.3, blue:0.51, alpha:1)
99 private let leftButton = UIButton()
102 private let leftButton = UIButton()
100 private let rightButton = UIButton()
103 private let rightButton = UIButton()
101 private let label = UILabel()
104 private let label = UILabel()
@@ -147,19 +150,27 @@ import UIKit
149 @objc private func leftButtonTapped(button: UIButton) {
152 @objc private func leftButtonTapped(button: UIButton) {
153+ if value == minimumValue {
154+ animateLimitHitForButton(leftButton)
150− value -= 1
156+ value -= 1
151− animateSlideLeft()
157+ animateSlideLeft()
154 @objc private func rightButtonTapped(button: UIButton) {
161 @objc private func rightButtonTapped(button: UIButton) {
162+ if value == maximumValue {
163+ animateLimitHitForButton(rightButton)
155− value += 1
165+ value += 1
156− animateSlideRight()
166+ animateSlideRight()
159 private func animateSlideLeft() {
170 private func animateSlideLeft() {
160 UIView.animateWithDuration(labelSlideDuration, animations: {
171 UIView.animateWithDuration(labelSlideDuration, animations: {
161 self.label.center.x -= self.labelSlideLength
172 self.label.center.x -= self.labelSlideLength
162− }, completion : { _ in
173+ }, completion: { _ in
163 UIView.animateWithDuration(self.labelSlideDuration, animations: {
174 UIView.animateWithDuration(self.labelSlideDuration, animations: {
164 self.label.center.x += self.labelSlideLength
175 self.label.center.x += self.labelSlideLength
@@ -169,10 +180,18 @@ import UIKit
169 private func animateSlideRight() {
180 private func animateSlideRight() {
170 UIView.animateWithDuration(labelSlideDuration, animations: {
181 UIView.animateWithDuration(labelSlideDuration, animations: {
171 self.label.center.x += self.labelSlideLength
182 self.label.center.x += self.labelSlideLength
172− }, completion : { _ in
183+ }, completion: { _ in
173 UIView.animateWithDuration(self.labelSlideDuration, animations: {
184 UIView.animateWithDuration(self.labelSlideDuration, animations: {
174 self.label.center.x -= self.labelSlideLength
185 self.label.center.x -= self.labelSlideLength
190+ private func animateLimitHitForButton(button: UIButton){
191+ UIView.animateWithDuration(limitHitAnimationDuration, animations: {
192+ button.backgroundColor = self.limitHitAnimationColor
193+ }, completion: { _ in
194+ button.backgroundColor = self.buttonsBackgroundColor