Skip to content

Commit

Permalink
Update for Swift 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Reda Lemeden committed Mar 30, 2016
1 parent a2cd471 commit 91ba745
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/Animator.swift
Expand Up @@ -103,12 +103,12 @@ class Animator {

timeSinceLastFrameChange -= frameDuration
let lastFrameIndex = currentFrameIndex
currentFrameIndex = ++currentFrameIndex % animatedFrames.count
currentFrameIndex = (currentFrameIndex + 1) % animatedFrames.count

// Loads the next needed frame for progressive loading
if animatedFrames.count < frameCount {
animatedFrames[lastFrameIndex] = prepareFrame(currentPreloadIndex)
currentPreloadIndex = ++currentPreloadIndex % frameCount
currentPreloadIndex = (currentFrameIndex + 1) % frameCount
}

return true
Expand Down
9 changes: 5 additions & 4 deletions Source/ImageSourceHelpers.swift
Expand Up @@ -32,16 +32,17 @@ func capDuration(duration: Double) -> Double? {
///
/// - returns: A frame duration.
func durationFromGIFProperties(properties: GIFProperties) -> Double? {
let unclampedDelayTime = properties[String(kCGImagePropertyGIFUnclampedDelayTime)]
let delayTime = properties[String(kCGImagePropertyGIFDelayTime)]
guard let unclampedDelayTime = properties[String(kCGImagePropertyGIFUnclampedDelayTime)],
let delayTime = properties[String(kCGImagePropertyGIFDelayTime)]
else { return .None }

return duration <^> unclampedDelayTime <*> delayTime
return duration(unclampedDelayTime, delayTime: delayTime)
}

/// Calculates frame duration based on both clamped and unclamped times.
///
/// - returns: A frame duration.
func duration(unclampedDelayTime: Double)(delayTime: Double) -> Double {
func duration(unclampedDelayTime: Double, delayTime: Double) -> Double {
let delayArray = [unclampedDelayTime, delayTime]
return delayArray.filter(isPositive).first ?? defaultDuration
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Info.plist
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>1.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>79</string>
<string>87</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down

0 comments on commit 91ba745

Please sign in to comment.