├── .gitignore ├── LICENSE ├── README.md ├── YLGIFImage-Swift ├── YLGIFImage.swift └── YLImageView.swift ├── YLGIFImageSwiftDemo ├── YLGIFImageSwiftDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── YLGIFImageSwiftDemo │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Info.plist │ ├── Launch Screen.xib │ ├── ViewController.swift │ ├── iwatch.gif │ └── joy.gif └── YLGIFImageSwiftDemoTests │ ├── Info.plist │ └── YLGIFImageSwiftDemoTests.swift ├── demo.gif └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .Trashes 3 | *.swp 4 | *.lock 5 | DerivedData/ 6 | build/ 7 | *.pbxuser 8 | *.mode1v3 9 | *.mode2v3 10 | *.perspectivev3 11 | !default.pbxuser 12 | !default.mode1v3 13 | !default.mode2v3 14 | !default.perspectivev3 15 | xcuserdata 16 | *.moved-aside 17 | Pods/ 18 | *.xcworkspace 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Yong Li 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | YLGIFImage-Swift 2 | ================ 3 | 4 | Swift implementation of [YLGIFImage](https://github.com/liyong03/YLGIFImage). 5 | 6 | 7 | -------------------------------------------------------------------------------- /YLGIFImage-Swift/YLGIFImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YLGIFImage.swift 3 | // YLGIFImage 4 | // 5 | // Created by Yong Li on 6/8/14. 6 | // Copyright (c) 2014 Yong Li. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import ImageIO 11 | import MobileCoreServices 12 | 13 | class YLGIFImage : UIImage { 14 | 15 | private class func isCGImageSourceContainAnimatedGIF(cgImageSource: CGImageSource!) -> Bool { 16 | let isGIF = UTTypeConformsTo(CGImageSourceGetType(cgImageSource)!, kUTTypeGIF) 17 | let imgCount = CGImageSourceGetCount(cgImageSource) 18 | return isGIF && imgCount > 1 19 | } 20 | 21 | private class func getCGImageSourceGifFrameDelay(imageSource: CGImageSourceRef, index: UInt) -> NSTimeInterval { 22 | var delay = 0.0 23 | let imgProperties:NSDictionary = CGImageSourceCopyPropertiesAtIndex(imageSource, Int(index), nil)! 24 | let gifProperties:NSDictionary? = imgProperties[kCGImagePropertyGIFDictionary as String] as? NSDictionary 25 | if let property = gifProperties { 26 | delay = property[kCGImagePropertyGIFUnclampedDelayTime as String] as! Double 27 | if delay <= 0 { 28 | delay = property[kCGImagePropertyGIFDelayTime as String] as! Double 29 | } 30 | } 31 | return delay 32 | } 33 | 34 | private func createSelf(cgImageSource: CGImageSource!, scale: CGFloat) -> Void { 35 | _cgImgSource = cgImageSource 36 | let imageProperties:NSDictionary = CGImageSourceCopyProperties(_cgImgSource!, nil)! 37 | let gifProperties: NSDictionary? = imageProperties[kCGImagePropertyGIFDictionary as String] as? NSDictionary 38 | if let property = gifProperties { 39 | self.loopCount = property[kCGImagePropertyGIFLoopCount as String] as! UInt 40 | } 41 | let numOfFrames = CGImageSourceGetCount(cgImageSource) 42 | for i in 0.. UIImage? { 120 | if Int(index) >= self.frameImages.count { 121 | return nil 122 | } 123 | let image:UIImage? = self.frameImages[Int(index)] as? UIImage 124 | if self.frameImages.count > Int(YLGIFImage.prefetchNum) { 125 | if index != 0 { 126 | self.frameImages[Int(index)] = NSNull() 127 | } 128 | 129 | for i in index+1...index+YLGIFImage.prefetchNum { 130 | let idx = Int(i)%self.frameImages.count 131 | if self.frameImages[idx] is NSNull { 132 | dispatch_async(self.readFrameQueue){ 133 | let cgImg = CGImageSourceCreateImageAtIndex(self._cgImgSource!, idx, nil) 134 | self.frameImages[idx] = UIImage(CGImage: cgImg!) 135 | } 136 | } 137 | } 138 | } 139 | 140 | return image 141 | } 142 | } -------------------------------------------------------------------------------- /YLGIFImage-Swift/YLImageView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YLImageView.swift 3 | // YLGIFImage 4 | // 5 | // Created by Yong Li on 6/8/14. 6 | // Copyright (c) 2014 Yong Li. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import QuartzCore 11 | 12 | class YLImageView : UIImageView { 13 | 14 | private lazy var displayLink:CADisplayLink = CADisplayLink(target: self, selector: "changeKeyFrame:") 15 | private var accumulator: NSTimeInterval = 0.0 16 | private var currentFrameIndex: Int = 0 17 | private var currentFrame: UIImage? = nil 18 | private var loopCountdown: Int = Int.max 19 | private var animatedImage: YLGIFImage? = nil 20 | 21 | required init?(coder aDecoder: NSCoder) { 22 | super.init(coder: aDecoder) 23 | self.displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) 24 | self.displayLink.paused = true 25 | } 26 | 27 | override init(frame: CGRect) { 28 | super.init(frame: frame) 29 | self.displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) 30 | self.displayLink.paused = true 31 | } 32 | 33 | override init(image: UIImage?) { 34 | super.init(image: image) 35 | self.displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) 36 | self.displayLink.paused = true 37 | } 38 | 39 | override init(image: UIImage?, highlightedImage: UIImage!) { 40 | super.init(image: image, highlightedImage: highlightedImage) 41 | self.displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) 42 | self.displayLink.paused = true 43 | } 44 | 45 | override var image: UIImage! { 46 | get { 47 | if (self.animatedImage != nil) { 48 | return self.animatedImage 49 | } else { 50 | return super.image 51 | } 52 | } 53 | set{ 54 | if image === newValue { 55 | return 56 | } 57 | self.stopAnimating() 58 | self.currentFrameIndex = 0 59 | self.accumulator = 0.0 60 | 61 | if newValue is YLGIFImage { 62 | self.animatedImage = newValue as? YLGIFImage 63 | if let Img = self.animatedImage!.getFrame(0) { 64 | super.image = Img 65 | self.currentFrame = super.image 66 | } 67 | self.startAnimating() 68 | } else { 69 | super.image = newValue 70 | self.animatedImage = nil 71 | } 72 | self.layer.setNeedsDisplay() 73 | } 74 | } 75 | 76 | override var highlighted: Bool { 77 | get{ 78 | return super.highlighted 79 | } 80 | set { 81 | if (self.animatedImage != nil) { 82 | return 83 | } else { 84 | return super.highlighted = newValue 85 | } 86 | } 87 | } 88 | 89 | override func isAnimating() -> Bool { 90 | if (self.animatedImage != nil) { 91 | return !self.displayLink.paused 92 | } else { 93 | return super.isAnimating() 94 | } 95 | } 96 | 97 | override func startAnimating() { 98 | if (self.animatedImage != nil) { 99 | self.displayLink.paused = false 100 | } else { 101 | super.startAnimating() 102 | } 103 | } 104 | 105 | override func stopAnimating() { 106 | if (self.animatedImage != nil) { 107 | self.displayLink.paused = true 108 | } else { 109 | super.stopAnimating() 110 | } 111 | } 112 | 113 | override func displayLayer(layer: CALayer) { 114 | if (self.animatedImage != nil) { 115 | if let frame = self.currentFrame { 116 | layer.contents = frame.CGImage 117 | } 118 | } else { 119 | return 120 | } 121 | } 122 | 123 | func changeKeyFrame(dpLink: CADisplayLink!) -> Void { 124 | if let animatedImg = self.animatedImage { 125 | if self.currentFrameIndex < animatedImg.frameImages.count { 126 | self.accumulator += fmin(1.0, dpLink.duration) 127 | var frameDura = animatedImg.frameDurations[self.currentFrameIndex] as! NSNumber 128 | while self.accumulator >= frameDura.doubleValue 129 | { 130 | self.accumulator = self.accumulator - frameDura.doubleValue//animatedImg.frameDurations[self.currentFrameIndex] 131 | self.currentFrameIndex++ 132 | if Int(self.currentFrameIndex) >= animatedImg.frameImages.count { 133 | self.currentFrameIndex = 0 134 | } 135 | if let Img = animatedImg.getFrame(UInt(self.currentFrameIndex)) { 136 | self.currentFrame = Img 137 | } 138 | self.layer.setNeedsDisplay() 139 | frameDura = animatedImg.frameDurations[self.currentFrameIndex] as! NSNumber 140 | } 141 | 142 | } 143 | } else { 144 | self.stopAnimating() 145 | } 146 | } 147 | } -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4E5096751961B64000D37D33 /* joy.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4E5096741961B64000D37D33 /* joy.gif */; }; 11 | 4E8046C019447FB6007EFB50 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8046BF19447FB6007EFB50 /* AppDelegate.swift */; }; 12 | 4E8046C219447FB6007EFB50 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8046C119447FB6007EFB50 /* ViewController.swift */; }; 13 | 4E8046C519447FB6007EFB50 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4E8046C319447FB6007EFB50 /* Main.storyboard */; }; 14 | 4E8046C719447FB6007EFB50 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4E8046C619447FB6007EFB50 /* Images.xcassets */; }; 15 | 4E8046D319447FB6007EFB50 /* YLGIFImageSwiftDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8046D219447FB6007EFB50 /* YLGIFImageSwiftDemoTests.swift */; }; 16 | 4E8046DF19447FF7007EFB50 /* YLGIFImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8046DD19447FF7007EFB50 /* YLGIFImage.swift */; }; 17 | 4E8046E019447FF7007EFB50 /* YLImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8046DE19447FF7007EFB50 /* YLImageView.swift */; }; 18 | 4E8046E2194480E9007EFB50 /* iwatch.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4E8046E1194480E9007EFB50 /* iwatch.gif */; }; 19 | 4E8046E3194480E9007EFB50 /* iwatch.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4E8046E1194480E9007EFB50 /* iwatch.gif */; }; 20 | DFAC28131AFB3A5A002A21F9 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = DFAC28121AFB3A5A002A21F9 /* Launch Screen.xib */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 4E8046CD19447FB6007EFB50 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 4E8046B219447FB6007EFB50 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 4E8046B919447FB6007EFB50; 29 | remoteInfo = YLGIFImageSwiftDemo; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 4E5096741961B64000D37D33 /* joy.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = joy.gif; sourceTree = ""; }; 35 | 4E8046BA19447FB6007EFB50 /* YLGIFImageSwiftDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YLGIFImageSwiftDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 4E8046BE19447FB6007EFB50 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 4E8046BF19447FB6007EFB50 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | 4E8046C119447FB6007EFB50 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 39 | 4E8046C419447FB6007EFB50 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | 4E8046C619447FB6007EFB50 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | 4E8046CC19447FB6007EFB50 /* YLGIFImageSwiftDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YLGIFImageSwiftDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 4E8046D119447FB6007EFB50 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 4E8046D219447FB6007EFB50 /* YLGIFImageSwiftDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YLGIFImageSwiftDemoTests.swift; sourceTree = ""; }; 44 | 4E8046DD19447FF7007EFB50 /* YLGIFImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YLGIFImage.swift; path = "../YLGIFImage-Swift/YLGIFImage.swift"; sourceTree = ""; }; 45 | 4E8046DE19447FF7007EFB50 /* YLImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YLImageView.swift; path = "../YLGIFImage-Swift/YLImageView.swift"; sourceTree = ""; }; 46 | 4E8046E1194480E9007EFB50 /* iwatch.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = iwatch.gif; sourceTree = ""; }; 47 | DFAC28121AFB3A5A002A21F9 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 4E8046B719447FB6007EFB50 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 4E8046C919447FB6007EFB50 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 4E8046B119447FB6007EFB50 = { 69 | isa = PBXGroup; 70 | children = ( 71 | 4E8046DC19447FCC007EFB50 /* Classes */, 72 | 4E8046BC19447FB6007EFB50 /* YLGIFImageSwiftDemo */, 73 | 4E8046CF19447FB6007EFB50 /* YLGIFImageSwiftDemoTests */, 74 | 4E8046BB19447FB6007EFB50 /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 4E8046BB19447FB6007EFB50 /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 4E8046BA19447FB6007EFB50 /* YLGIFImageSwiftDemo.app */, 82 | 4E8046CC19447FB6007EFB50 /* YLGIFImageSwiftDemoTests.xctest */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | 4E8046BC19447FB6007EFB50 /* YLGIFImageSwiftDemo */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4E8046BF19447FB6007EFB50 /* AppDelegate.swift */, 91 | 4E8046C119447FB6007EFB50 /* ViewController.swift */, 92 | 4E8046C319447FB6007EFB50 /* Main.storyboard */, 93 | 4E8046E1194480E9007EFB50 /* iwatch.gif */, 94 | 4E5096741961B64000D37D33 /* joy.gif */, 95 | 4E8046C619447FB6007EFB50 /* Images.xcassets */, 96 | 4E8046BD19447FB6007EFB50 /* Supporting Files */, 97 | DFAC28121AFB3A5A002A21F9 /* Launch Screen.xib */, 98 | ); 99 | path = YLGIFImageSwiftDemo; 100 | sourceTree = ""; 101 | }; 102 | 4E8046BD19447FB6007EFB50 /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 4E8046BE19447FB6007EFB50 /* Info.plist */, 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | 4E8046CF19447FB6007EFB50 /* YLGIFImageSwiftDemoTests */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 4E8046D219447FB6007EFB50 /* YLGIFImageSwiftDemoTests.swift */, 114 | 4E8046D019447FB6007EFB50 /* Supporting Files */, 115 | ); 116 | path = YLGIFImageSwiftDemoTests; 117 | sourceTree = ""; 118 | }; 119 | 4E8046D019447FB6007EFB50 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 4E8046D119447FB6007EFB50 /* Info.plist */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | 4E8046DC19447FCC007EFB50 /* Classes */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 4E8046DD19447FF7007EFB50 /* YLGIFImage.swift */, 131 | 4E8046DE19447FF7007EFB50 /* YLImageView.swift */, 132 | ); 133 | name = Classes; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | 4E8046B919447FB6007EFB50 /* YLGIFImageSwiftDemo */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 4E8046D619447FB6007EFB50 /* Build configuration list for PBXNativeTarget "YLGIFImageSwiftDemo" */; 142 | buildPhases = ( 143 | 4E8046B619447FB6007EFB50 /* Sources */, 144 | 4E8046B719447FB6007EFB50 /* Frameworks */, 145 | 4E8046B819447FB6007EFB50 /* Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | ); 151 | name = YLGIFImageSwiftDemo; 152 | productName = YLGIFImageSwiftDemo; 153 | productReference = 4E8046BA19447FB6007EFB50 /* YLGIFImageSwiftDemo.app */; 154 | productType = "com.apple.product-type.application"; 155 | }; 156 | 4E8046CB19447FB6007EFB50 /* YLGIFImageSwiftDemoTests */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = 4E8046D919447FB6007EFB50 /* Build configuration list for PBXNativeTarget "YLGIFImageSwiftDemoTests" */; 159 | buildPhases = ( 160 | 4E8046C819447FB6007EFB50 /* Sources */, 161 | 4E8046C919447FB6007EFB50 /* Frameworks */, 162 | 4E8046CA19447FB6007EFB50 /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | 4E8046CE19447FB6007EFB50 /* PBXTargetDependency */, 168 | ); 169 | name = YLGIFImageSwiftDemoTests; 170 | productName = YLGIFImageSwiftDemoTests; 171 | productReference = 4E8046CC19447FB6007EFB50 /* YLGIFImageSwiftDemoTests.xctest */; 172 | productType = "com.apple.product-type.bundle.unit-test"; 173 | }; 174 | /* End PBXNativeTarget section */ 175 | 176 | /* Begin PBXProject section */ 177 | 4E8046B219447FB6007EFB50 /* Project object */ = { 178 | isa = PBXProject; 179 | attributes = { 180 | LastSwiftMigration = 0720; 181 | LastSwiftUpdateCheck = 0720; 182 | LastUpgradeCheck = 0600; 183 | ORGANIZATIONNAME = "Yong Li"; 184 | TargetAttributes = { 185 | 4E8046B919447FB6007EFB50 = { 186 | CreatedOnToolsVersion = 6.0; 187 | }; 188 | 4E8046CB19447FB6007EFB50 = { 189 | CreatedOnToolsVersion = 6.0; 190 | TestTargetID = 4E8046B919447FB6007EFB50; 191 | }; 192 | }; 193 | }; 194 | buildConfigurationList = 4E8046B519447FB6007EFB50 /* Build configuration list for PBXProject "YLGIFImageSwiftDemo" */; 195 | compatibilityVersion = "Xcode 3.2"; 196 | developmentRegion = English; 197 | hasScannedForEncodings = 0; 198 | knownRegions = ( 199 | en, 200 | Base, 201 | ); 202 | mainGroup = 4E8046B119447FB6007EFB50; 203 | productRefGroup = 4E8046BB19447FB6007EFB50 /* Products */; 204 | projectDirPath = ""; 205 | projectRoot = ""; 206 | targets = ( 207 | 4E8046B919447FB6007EFB50 /* YLGIFImageSwiftDemo */, 208 | 4E8046CB19447FB6007EFB50 /* YLGIFImageSwiftDemoTests */, 209 | ); 210 | }; 211 | /* End PBXProject section */ 212 | 213 | /* Begin PBXResourcesBuildPhase section */ 214 | 4E8046B819447FB6007EFB50 /* Resources */ = { 215 | isa = PBXResourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 4E8046C519447FB6007EFB50 /* Main.storyboard in Resources */, 219 | 4E5096751961B64000D37D33 /* joy.gif in Resources */, 220 | 4E8046E2194480E9007EFB50 /* iwatch.gif in Resources */, 221 | 4E8046C719447FB6007EFB50 /* Images.xcassets in Resources */, 222 | DFAC28131AFB3A5A002A21F9 /* Launch Screen.xib in Resources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | 4E8046CA19447FB6007EFB50 /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | 4E8046E3194480E9007EFB50 /* iwatch.gif in Resources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXResourcesBuildPhase section */ 235 | 236 | /* Begin PBXSourcesBuildPhase section */ 237 | 4E8046B619447FB6007EFB50 /* Sources */ = { 238 | isa = PBXSourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | 4E8046DF19447FF7007EFB50 /* YLGIFImage.swift in Sources */, 242 | 4E8046C219447FB6007EFB50 /* ViewController.swift in Sources */, 243 | 4E8046C019447FB6007EFB50 /* AppDelegate.swift in Sources */, 244 | 4E8046E019447FF7007EFB50 /* YLImageView.swift in Sources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | 4E8046C819447FB6007EFB50 /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | 4E8046D319447FB6007EFB50 /* YLGIFImageSwiftDemoTests.swift in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | /* End PBXSourcesBuildPhase section */ 257 | 258 | /* Begin PBXTargetDependency section */ 259 | 4E8046CE19447FB6007EFB50 /* PBXTargetDependency */ = { 260 | isa = PBXTargetDependency; 261 | target = 4E8046B919447FB6007EFB50 /* YLGIFImageSwiftDemo */; 262 | targetProxy = 4E8046CD19447FB6007EFB50 /* PBXContainerItemProxy */; 263 | }; 264 | /* End PBXTargetDependency section */ 265 | 266 | /* Begin PBXVariantGroup section */ 267 | 4E8046C319447FB6007EFB50 /* Main.storyboard */ = { 268 | isa = PBXVariantGroup; 269 | children = ( 270 | 4E8046C419447FB6007EFB50 /* Base */, 271 | ); 272 | name = Main.storyboard; 273 | sourceTree = ""; 274 | }; 275 | /* End PBXVariantGroup section */ 276 | 277 | /* Begin XCBuildConfiguration section */ 278 | 4E8046D419447FB6007EFB50 /* Debug */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | ALWAYS_SEARCH_USER_PATHS = NO; 282 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 283 | CLANG_CXX_LIBRARY = "libc++"; 284 | CLANG_ENABLE_MODULES = YES; 285 | CLANG_ENABLE_OBJC_ARC = YES; 286 | CLANG_WARN_BOOL_CONVERSION = YES; 287 | CLANG_WARN_CONSTANT_CONVERSION = YES; 288 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 289 | CLANG_WARN_EMPTY_BODY = YES; 290 | CLANG_WARN_ENUM_CONVERSION = YES; 291 | CLANG_WARN_INT_CONVERSION = YES; 292 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 293 | CLANG_WARN_UNREACHABLE_CODE = YES; 294 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 295 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 296 | COPY_PHASE_STRIP = NO; 297 | ENABLE_STRICT_OBJC_MSGSEND = YES; 298 | GCC_C_LANGUAGE_STANDARD = gnu99; 299 | GCC_DYNAMIC_NO_PIC = NO; 300 | GCC_OPTIMIZATION_LEVEL = 0; 301 | GCC_PREPROCESSOR_DEFINITIONS = ( 302 | "DEBUG=1", 303 | "$(inherited)", 304 | ); 305 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 308 | GCC_WARN_UNDECLARED_SELECTOR = YES; 309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 310 | GCC_WARN_UNUSED_FUNCTION = YES; 311 | GCC_WARN_UNUSED_VARIABLE = YES; 312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 313 | METAL_ENABLE_DEBUG_INFO = YES; 314 | ONLY_ACTIVE_ARCH = YES; 315 | SDKROOT = iphoneos; 316 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 317 | TARGETED_DEVICE_FAMILY = "1,2"; 318 | }; 319 | name = Debug; 320 | }; 321 | 4E8046D519447FB6007EFB50 /* Release */ = { 322 | isa = XCBuildConfiguration; 323 | buildSettings = { 324 | ALWAYS_SEARCH_USER_PATHS = NO; 325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 326 | CLANG_CXX_LIBRARY = "libc++"; 327 | CLANG_ENABLE_MODULES = YES; 328 | CLANG_ENABLE_OBJC_ARC = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_CONSTANT_CONVERSION = YES; 331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 332 | CLANG_WARN_EMPTY_BODY = YES; 333 | CLANG_WARN_ENUM_CONVERSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 339 | COPY_PHASE_STRIP = YES; 340 | ENABLE_NS_ASSERTIONS = NO; 341 | ENABLE_STRICT_OBJC_MSGSEND = YES; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 350 | METAL_ENABLE_DEBUG_INFO = NO; 351 | SDKROOT = iphoneos; 352 | TARGETED_DEVICE_FAMILY = "1,2"; 353 | VALIDATE_PRODUCT = YES; 354 | }; 355 | name = Release; 356 | }; 357 | 4E8046D719447FB6007EFB50 /* Debug */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 361 | CODE_SIGN_IDENTITY = "iPhone Developer"; 362 | INFOPLIST_FILE = YLGIFImageSwiftDemo/Info.plist; 363 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | }; 367 | name = Debug; 368 | }; 369 | 4E8046D819447FB6007EFB50 /* Release */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 373 | CODE_SIGN_IDENTITY = "iPhone Developer"; 374 | INFOPLIST_FILE = YLGIFImageSwiftDemo/Info.plist; 375 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | }; 379 | name = Release; 380 | }; 381 | 4E8046DA19447FB6007EFB50 /* Debug */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/YLGIFImageSwiftDemo.app/YLGIFImageSwiftDemo"; 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(SDKROOT)/Developer/Library/Frameworks", 387 | "$(inherited)", 388 | ); 389 | GCC_PREPROCESSOR_DEFINITIONS = ( 390 | "DEBUG=1", 391 | "$(inherited)", 392 | ); 393 | INFOPLIST_FILE = YLGIFImageSwiftDemoTests/Info.plist; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 395 | METAL_ENABLE_DEBUG_INFO = YES; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | TEST_HOST = "$(BUNDLE_LOADER)"; 398 | }; 399 | name = Debug; 400 | }; 401 | 4E8046DB19447FB6007EFB50 /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/YLGIFImageSwiftDemo.app/YLGIFImageSwiftDemo"; 405 | FRAMEWORK_SEARCH_PATHS = ( 406 | "$(SDKROOT)/Developer/Library/Frameworks", 407 | "$(inherited)", 408 | ); 409 | INFOPLIST_FILE = YLGIFImageSwiftDemoTests/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 411 | METAL_ENABLE_DEBUG_INFO = NO; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | TEST_HOST = "$(BUNDLE_LOADER)"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | 4E8046B519447FB6007EFB50 /* Build configuration list for PBXProject "YLGIFImageSwiftDemo" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | 4E8046D419447FB6007EFB50 /* Debug */, 424 | 4E8046D519447FB6007EFB50 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | 4E8046D619447FB6007EFB50 /* Build configuration list for PBXNativeTarget "YLGIFImageSwiftDemo" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 4E8046D719447FB6007EFB50 /* Debug */, 433 | 4E8046D819447FB6007EFB50 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | 4E8046D919447FB6007EFB50 /* Build configuration list for PBXNativeTarget "YLGIFImageSwiftDemoTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 4E8046DA19447FB6007EFB50 /* Debug */, 442 | 4E8046DB19447FB6007EFB50 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = 4E8046B219447FB6007EFB50 /* Project object */; 450 | } 451 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // YLGIFImageSwiftDemo 4 | // 5 | // Created by Yong Li on 6/8/14. 6 | // Copyright (c) 2014 Yong Li. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.ronnie.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | Launch Screen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/Launch Screen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // YLGIFImageSwiftDemo 4 | // 5 | // Created by Yong Li on 6/8/14. 6 | // Copyright (c) 2014 Yong Li. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet var imageView: UIImageView! 14 | @IBOutlet var button: UIButton! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | self.navigationItem.title = "YLGIFImage Swift" 19 | 20 | YLGIFImage.setPrefetchNum(5) 21 | 22 | // Do any additional setup after loading the view, typically from a nib. 23 | let path = NSBundle.mainBundle().URLForResource("iwatch", withExtension: "gif")?.absoluteString as String! 24 | imageView.image = YLGIFImage(contentsOfFile: path) 25 | 26 | if imageView.isAnimating() { 27 | self.button.setTitle("Pause", forState: UIControlState.Normal) 28 | } else { 29 | self.button.setTitle("Play", forState: UIControlState.Normal) 30 | } 31 | } 32 | 33 | override func didReceiveMemoryWarning() { 34 | super.didReceiveMemoryWarning() 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | @IBAction func clicked(button:UIButton) { 39 | 40 | if imageView.isAnimating() { 41 | imageView.stopAnimating() 42 | } else { 43 | imageView.startAnimating() 44 | } 45 | 46 | if imageView.isAnimating() { 47 | self.button.setTitle("Pause", forState: UIControlState.Normal) 48 | } else { 49 | self.button.setTitle("Play", forState: UIControlState.Normal) 50 | } 51 | } 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/iwatch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyong03/YLGIFImage-Swift/f02e8737eb59c1cf0f70ab204c567b4eb51209dd/YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/iwatch.gif -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/joy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyong03/YLGIFImage-Swift/f02e8737eb59c1cf0f70ab204c567b4eb51209dd/YLGIFImageSwiftDemo/YLGIFImageSwiftDemo/joy.gif -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.ronnie.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /YLGIFImageSwiftDemo/YLGIFImageSwiftDemoTests/YLGIFImageSwiftDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YLGIFImageSwiftDemoTests.swift 3 | // YLGIFImageSwiftDemoTests 4 | // 5 | // Created by Yong Li on 6/8/14. 6 | // Copyright (c) 2014 Yong Li. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class YLGIFImageSwiftDemoTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyong03/YLGIFImage-Swift/f02e8737eb59c1cf0f70ab204c567b4eb51209dd/demo.gif -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyong03/YLGIFImage-Swift/f02e8737eb59c1cf0f70ab204c567b4eb51209dd/screenshot.png --------------------------------------------------------------------------------