From 86a43066f423906b46f5bc10ad65246398e9965a Mon Sep 17 00:00:00 2001 From: Reda Lemeden Date: Mon, 10 Nov 2014 22:57:37 +0100 Subject: [PATCH] Rename animation methods to avoid UKit conflicts Fixes #2 --- demo/classes/ViewController.swift | 8 ++++---- source/UIImageView+Gifu.swift | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/demo/classes/ViewController.swift b/demo/classes/ViewController.swift index cd13883..5520dce 100644 --- a/demo/classes/ViewController.swift +++ b/demo/classes/ViewController.swift @@ -8,17 +8,17 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() imageView.setAnimatableImage(named: "mugen.gif") - imageView.startAnimating() + imageView.startAnimatingGIF() UIApplication.sharedApplication().setStatusBarStyle(.LightContent, animated: false) } @IBAction func toggleAnimation(button: UIButton) { - if imageView.isAnimating { - imageView.stopAnimating() + if imageView.isAnimatingGIF { + imageView.stopAnimatingGIF() button.layer.backgroundColor = UIColor.whiteColor().CGColor button.setTitleColor(UIColor.blackColor(), forState: .Normal) } else { - imageView.startAnimating() + imageView.startAnimatingGIF() button.layer.backgroundColor = UIColor.clearColor().CGColor button.setTitleColor(UIColor.whiteColor(), forState: .Normal) } diff --git a/source/UIImageView+Gifu.swift b/source/UIImageView+Gifu.swift index 49597de..6cae739 100644 --- a/source/UIImageView+Gifu.swift +++ b/source/UIImageView+Gifu.swift @@ -10,8 +10,8 @@ extension UIImageView { } } - var isAnimating: Bool { - return animatableImage?.isAnimating() ?? false + var isAnimatingGIF: Bool { + return animatableImage?.isAnimating() ?? isAnimating() } var animatable: Bool { @@ -39,15 +39,19 @@ extension UIImageView { } // MARK: - Animation - func startAnimating() { + func startAnimatingGIF() { if animatable { animatableImage!.resumeAnimation() + } else { + startAnimating() } } - func stopAnimating() { + func stopAnimatingGIF() { if animatable { animatableImage!.pauseAnimation() + } else { + stopAnimating() } } }