From a2df318b5e59571a494762e05490e0834d50416e Mon Sep 17 00:00:00 2001 From: delba Date: Fri, 7 Nov 2014 01:03:03 +0100 Subject: [PATCH] Use NSData - init(contentsOfFile) --- source/Gifu.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/Gifu.swift b/source/Gifu.swift index d1e2c47..7bacbfb 100644 --- a/source/Gifu.swift +++ b/source/Gifu.swift @@ -50,8 +50,12 @@ class AnimatedImage: UIImage { // MARK: - Factories class func imageWithName(name: String, delegate: UIImageView?) -> Self? { let path = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent(name) - let data = NSData.dataWithContentsOfFile(path, options: nil, error: nil) - return (data != nil) ? imageWithData(data, delegate: delegate) : nil + + if let data = NSData(contentsOfFile: path) { + return imageWithData(data, delegate: delegate) + } + + return nil } class func imageWithData(data: NSData, delegate: UIImageView?) -> Self? {