Update for Swift 2.2
This commit is contained in:
parent
a2cd471e52
commit
91ba7459cb
|
@ -103,12 +103,12 @@ class Animator {
|
||||||
|
|
||||||
timeSinceLastFrameChange -= frameDuration
|
timeSinceLastFrameChange -= frameDuration
|
||||||
let lastFrameIndex = currentFrameIndex
|
let lastFrameIndex = currentFrameIndex
|
||||||
currentFrameIndex = ++currentFrameIndex % animatedFrames.count
|
currentFrameIndex = (currentFrameIndex + 1) % animatedFrames.count
|
||||||
|
|
||||||
// Loads the next needed frame for progressive loading
|
// Loads the next needed frame for progressive loading
|
||||||
if animatedFrames.count < frameCount {
|
if animatedFrames.count < frameCount {
|
||||||
animatedFrames[lastFrameIndex] = prepareFrame(currentPreloadIndex)
|
animatedFrames[lastFrameIndex] = prepareFrame(currentPreloadIndex)
|
||||||
currentPreloadIndex = ++currentPreloadIndex % frameCount
|
currentPreloadIndex = (currentFrameIndex + 1) % frameCount
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -32,16 +32,17 @@ func capDuration(duration: Double) -> Double? {
|
||||||
///
|
///
|
||||||
/// - returns: A frame duration.
|
/// - returns: A frame duration.
|
||||||
func durationFromGIFProperties(properties: GIFProperties) -> Double? {
|
func durationFromGIFProperties(properties: GIFProperties) -> Double? {
|
||||||
let unclampedDelayTime = properties[String(kCGImagePropertyGIFUnclampedDelayTime)]
|
guard let unclampedDelayTime = properties[String(kCGImagePropertyGIFUnclampedDelayTime)],
|
||||||
let delayTime = properties[String(kCGImagePropertyGIFDelayTime)]
|
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.
|
/// Calculates frame duration based on both clamped and unclamped times.
|
||||||
///
|
///
|
||||||
/// - returns: A frame duration.
|
/// - returns: A frame duration.
|
||||||
func duration(unclampedDelayTime: Double)(delayTime: Double) -> Double {
|
func duration(unclampedDelayTime: Double, delayTime: Double) -> Double {
|
||||||
let delayArray = [unclampedDelayTime, delayTime]
|
let delayArray = [unclampedDelayTime, delayTime]
|
||||||
return delayArray.filter(isPositive).first ?? defaultDuration
|
return delayArray.filter(isPositive).first ?? defaultDuration
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0.1</string>
|
<string>1.1.0</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>79</string>
|
<string>87</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Loading…
Reference in New Issue