Skip to content

Commit

Permalink
Use NSDictionary - value/objectForKey
Browse files Browse the repository at this point in the history
- Closes #3, #4
  • Loading branch information
delba authored and Reda Lemeden committed Nov 10, 2014
1 parent a2df318 commit 4a3816c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions source/Gifu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions source/ImageSourceHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 4a3816c

Please sign in to comment.