@@ -93,6 +93,9 @@ import UIKit
9393 }
9494 }
9595
96+ private let labelSlideLength: CGFloat = 5
97+ private let labelSlideDuration: NSTimeInterval = 0.1
98+
9699 private let leftButton = UIButton()
97100 private let rightButton = UIButton()
98101 private let label = UILabel()
@@ -129,6 +132,7 @@ import UIKit
129132 label.font = labelFont
130133 addSubview(label)
131134
135+ backgroundColor = buttonsBackgroundColor
132136 layer.cornerRadius = cornerRadius
133137 clipsToBounds = true
134138 }
@@ -144,9 +148,31 @@ import UIKit
144148
145149 @objc private func leftButtonTapped(button: UIButton) {
146150 value -= 1
151+ animateSlideLeft()
147152 }
148153
149154 @objc private func rightButtonTapped(button: UIButton) {
150155 value += 1
156+ animateSlideRight()
157+ }
158+
159+ private func animateSlideLeft() {
160+ UIView.animateWithDuration(labelSlideDuration, animations: {
161+ self.label.center.x -= self.labelSlideLength
162+ }, completion : { _ in
163+ UIView.animateWithDuration(self.labelSlideDuration, animations: {
164+ self.label.center.x += self.labelSlideLength
165+ })
166+ })
167+ }
168+
169+ private func animateSlideRight() {
170+ UIView.animateWithDuration(labelSlideDuration, animations: {
171+ self.label.center.x += self.labelSlideLength
172+ }, completion : { _ in
173+ UIView.animateWithDuration(self.labelSlideDuration, animations: {
174+ self.label.center.x -= self.labelSlideLength
175+ })
176+ })
151177 }
152178}