From 4a3816c75f7843b60401f597e7b2b12dbfa26b3a Mon Sep 17 00:00:00 2001 From: delba Date: Fri, 7 Nov 2014 01:04:34 +0100 Subject: [PATCH] Use NSDictionary - value/objectForKey - Closes #3, #4 --- source/Gifu.swift | 6 +++--- source/ImageSourceHelpers.swift | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/Gifu.swift b/source/Gifu.swift index 7bacbfb..0db4911 100644 --- a/source/Gifu.swift +++ b/source/Gifu.swift @@ -50,11 +50,11 @@ class AnimatedImage: UIImage { // MARK: - Factories class func imageWithName(name: String, delegate: UIImageView?) -> Self? { let path = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent(name) - + if let data = NSData(contentsOfFile: path) { - return imageWithData(data, delegate: delegate) + return imageWithData(data, delegate: delegate) } - + return nil } diff --git a/source/ImageSourceHelpers.swift b/source/ImageSourceHelpers.swift index 3311a27..32ca990 100644 --- a/source/ImageSourceHelpers.swift +++ b/source/ImageSourceHelpers.swift @@ -14,13 +14,13 @@ func CGImageSourceGIFFrameDuration(imageSource: CGImageSource, index: Int) -> NS var duration = 0.0 let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, UInt(index), nil) as NSDictionary - let GIFProperties: NSDictionary? = imageProperties[kCGImagePropertyGIFDictionary] as? NSDictionary + let GIFProperties: NSDictionary? = imageProperties.objectForKey(kCGImagePropertyGIFDictionary) as? NSDictionary if let properties = GIFProperties { - duration = properties[kCGImagePropertyGIFUnclampedDelayTime] as Double + duration = properties.valueForKey(kCGImagePropertyGIFUnclampedDelayTime) as Double if duration <= 0 { - duration = properties[kCGImagePropertyGIFDelayTime] as Double + duration = properties.valueForKey(kCGImagePropertyGIFDelayTime) as Double } }