1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-10-11 03:49:05 +03:00

Animations collections extension refactoring

This commit is contained in:
Victor Sukochev 2016-04-13 15:04:27 +06:00
parent 9715b3de92
commit 53439bec81
2 changed files with 6 additions and 6 deletions

View File

@ -16,15 +16,15 @@ class PathExampleView: MacawView {
if paused { if paused {
playerBtn?.setTitle("Play", forState: .Normal) playerBtn?.setTitle("Play", forState: .Normal)
animation.pauseAnimation() animation.pauseAnimations()
} else { } else {
playerBtn?.setTitle("Pause", forState: .Normal) playerBtn?.setTitle("Pause", forState: .Normal)
animation.playAnimation() animation.playAnimations()
} }
} }
@IBAction func onProgressChanged(sender: UISlider) { @IBAction func onProgressChanged(sender: UISlider) {
animation.moveToAnimationPosition(Double(sender.value)) // currentProgress.set(Double(sender.value)) animation.moveAnimationsToPosition(Double(sender.value)) // currentProgress.set(Double(sender.value))
} }
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {

View File

@ -1,13 +1,13 @@
import Foundation import Foundation
public extension SequenceType where Generator.Element: Animatable { public extension SequenceType where Generator.Element: Animatable {
func playAnimation() { func playAnimations() {
self.forEach { animation in self.forEach { animation in
animation.play() animation.play()
} }
} }
func pauseAnimation() { func pauseAnimations() {
self.forEach { animation in self.forEach { animation in
animation.pause() animation.pause()
} }
@ -19,7 +19,7 @@ public extension SequenceType where Generator.Element: Animatable {
} }
} }
func moveToAnimationPosition(position: Double) { func moveAnimationsToPosition(position: Double) {
self.forEach { animation in self.forEach { animation in
animation.moveToPosition(position) animation.moveToPosition(position)
} }