Remove Runes dependency

- Closes #45
This commit is contained in:
Reda Lemeden 2016-04-24 12:19:13 +02:00
parent aa6e103e42
commit 47ef2e2008
No known key found for this signature in database
GPG Key ID: 2A4B46ECF1B02C90
9 changed files with 9 additions and 38 deletions

View File

@ -1 +0,0 @@
github "thoughtbot/Runes" >= 3.0.0

View File

@ -1 +0,0 @@
github "thoughtbot/Runes" "v3.1.0"

@ -1 +0,0 @@
Subproject commit 17ff8dcc1331ed1f2cb949d6af194844a180021c

View File

@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
0036ABB71BBD1D0B00C6CC3D /* mugen.gif in Resources */ = {isa = PBXBuildFile; fileRef = 0036ABB61BBD1D0B00C6CC3D /* mugen.gif */; };
0036ABB91BBD1D1400C6CC3D /* nailed.gif in Resources */ = {isa = PBXBuildFile; fileRef = 0036ABB81BBD1D1400C6CC3D /* nailed.gif */; };
004529921BD82209006493BF /* Runes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 004529911BD82209006493BF /* Runes.swift */; };
005656ED1A6F14D6008A0ED1 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 005656EC1A6F14D6008A0ED1 /* Animator.swift */; };
005656EF1A6F1C26008A0ED1 /* AnimatableImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 005656EE1A6F1C26008A0ED1 /* AnimatableImageView.swift */; };
007E08441BD95E6200883D0C /* ArrayExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 007E08431BD95E6200883D0C /* ArrayExtension.swift */; };
@ -19,7 +18,6 @@
00B8C75F1A364DCE00C188E7 /* ImageSourceHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B8C75C1A364DCE00C188E7 /* ImageSourceHelpers.swift */; };
00B8C7961A3650EE00C188E7 /* Gifu.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B8C7951A3650EE00C188E7 /* Gifu.h */; settings = {ATTRIBUTES = (Public, ); }; };
EAF49C7F1A3A4DE000B395DF /* UIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF49C7E1A3A4DE000B395DF /* UIImageExtension.swift */; };
EAF49C811A3A4FAA00B395DF /* FunctionalHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF49C801A3A4FAA00B395DF /* FunctionalHelpers.swift */; };
EAF49CB11A3B6EEB00B395DF /* AnimatedFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF49CB01A3B6EEB00B395DF /* AnimatedFrame.swift */; };
/* End PBXBuildFile section */
@ -36,7 +34,6 @@
/* Begin PBXFileReference section */
0036ABB61BBD1D0B00C6CC3D /* mugen.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = mugen.gif; path = Demo/demo/Images.xcassets/mugen.dataset/mugen.gif; sourceTree = SOURCE_ROOT; };
0036ABB81BBD1D1400C6CC3D /* nailed.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = nailed.gif; path = Demo/demo/Images.xcassets/nailed.dataset/nailed.gif; sourceTree = SOURCE_ROOT; };
004529911BD82209006493BF /* Runes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Runes.swift; path = Carthage/Checkouts/Runes/Source/Runes.swift; sourceTree = SOURCE_ROOT; };
005656EC1A6F14D6008A0ED1 /* Animator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = "<group>"; };
005656EE1A6F1C26008A0ED1 /* AnimatableImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableImageView.swift; sourceTree = "<group>"; };
007E08431BD95E6200883D0C /* ArrayExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayExtension.swift; sourceTree = "<group>"; };
@ -49,7 +46,6 @@
00B8C75C1A364DCE00C188E7 /* ImageSourceHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageSourceHelpers.swift; sourceTree = "<group>"; };
00B8C7951A3650EE00C188E7 /* Gifu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gifu.h; sourceTree = "<group>"; };
EAF49C7E1A3A4DE000B395DF /* UIImageExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageExtension.swift; sourceTree = "<group>"; };
EAF49C801A3A4FAA00B395DF /* FunctionalHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FunctionalHelpers.swift; sourceTree = "<group>"; };
EAF49CB01A3B6EEB00B395DF /* AnimatedFrame.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedFrame.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -94,8 +90,6 @@
007E08411BD95C0200883D0C /* Helpers */ = {
isa = PBXGroup;
children = (
004529911BD82209006493BF /* Runes.swift */,
EAF49C801A3A4FAA00B395DF /* FunctionalHelpers.swift */,
00B8C75C1A364DCE00C188E7 /* ImageSourceHelpers.swift */,
);
name = Helpers;
@ -299,10 +293,8 @@
005656EF1A6F1C26008A0ED1 /* AnimatableImageView.swift in Sources */,
005656ED1A6F14D6008A0ED1 /* Animator.swift in Sources */,
009BD1441BBC93C800FC982B /* CGSizeExtension.swift in Sources */,
004529921BD82209006493BF /* Runes.swift in Sources */,
EAF49CB11A3B6EEB00B395DF /* AnimatedFrame.swift in Sources */,
00B8C75F1A364DCE00C188E7 /* ImageSourceHelpers.swift in Sources */,
EAF49C811A3A4FAA00B395DF /* FunctionalHelpers.swift in Sources */,
007E08441BD95E6200883D0C /* ArrayExtension.swift in Sources */,
EAF49C7F1A3A4DE000B395DF /* UIImageExtension.swift in Sources */,
);

View File

@ -52,7 +52,8 @@ public class AnimatableImageView: UIImageView {
/// - parameter imageName: The name of the GIF file. The method looks for the file in the app bundle.
public func prepareForAnimation(imageNamed imageName: String) {
let imagePath = NSBundle.mainBundle().bundleURL.URLByAppendingPathComponent(imageName)
prepareForAnimation <^> NSData(contentsOfURL: imagePath)
guard let data = NSData(contentsOfURL: imagePath) else { return }
prepareForAnimation(imageData: data)
}
/// Prepares the frames using raw GIF image data, without starting the animation.

View File

@ -55,7 +55,7 @@ class Animator {
frameCount = Int(CGImageSourceGetCount(imageSource))
let framesToProcess = min(frameCount, maxFrameCount)
animatedFrames.reserveCapacity(framesToProcess)
animatedFrames = (0..<framesToProcess).reduce([]) { $0 + pure(prepareFrame($1)) }
animatedFrames = (0..<framesToProcess).reduce([]) { $0 + [prepareFrame($1)] }
currentPreloadIndex = framesToProcess
}

View File

@ -1,20 +0,0 @@
func <^> <T, U>(@noescape f: T -> U, a: T?) -> U? {
return a.map(f)
}
func <*> <T, U>(f: (T -> U)?, a: T?) -> U? {
return a.apply(f)
}
func >>- <T, U>(a: T?, @noescape f: T -> U?) -> U? {
return a.flatMap(f)
}
extension Optional {
func apply<U>(f: (Wrapped -> U)?) -> U? {
return f.flatMap { self.map($0) }
}
}
func pure<T>(a: T) -> [T] {
return [a]
}

View File

@ -11,11 +11,12 @@ let defaultDuration: Double = 0
func CGImageSourceGIFFrameDuration(imageSource: CGImageSource, index: Int) -> NSTimeInterval {
if !imageSource.isAnimatedGIF { return 0.0 }
let duration = imageSource.GIFPropertiesAtIndex(index)
>>- durationFromGIFProperties
>>- capDuration
guard let properties = imageSource.GIFPropertiesAtIndex(index),
let duration = durationFromGIFProperties(properties),
let cappedDuration = capDuration(duration)
else { return defaultDuration }
return duration ?? defaultDuration
return cappedDuration
}
/// Ensures that a duration is never smaller than a threshold value.

View File

@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>87</string>
<string>91</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>