Update for Swift 2.2
This commit is contained in:
parent
a2cd471e52
commit
91ba7459cb
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue