├── Dynamic-Image-Height ├── Assets.xcassets │ ├── Contents.json │ ├── salman khan │ │ ├── Contents.json │ │ ├── 1.imageset │ │ │ ├── 1.jpg │ │ │ └── Contents.json │ │ ├── 2.imageset │ │ │ ├── 2.jpg │ │ │ └── Contents.json │ │ ├── 3.imageset │ │ │ ├── 3.jpg │ │ │ └── Contents.json │ │ ├── 4.imageset │ │ │ ├── 4.jpg │ │ │ └── Contents.json │ │ ├── 5.imageset │ │ │ ├── 5.png │ │ │ └── Contents.json │ │ ├── 6.imageset │ │ │ ├── 6.jpg │ │ │ └── Contents.json │ │ ├── 7.imageset │ │ │ ├── 7.jpeg │ │ │ └── Contents.json │ │ ├── 8.imageset │ │ │ ├── 8.jpeg │ │ │ └── Contents.json │ │ ├── 9.imageset │ │ │ ├── 9.jpg │ │ │ └── Contents.json │ │ ├── 10.imageset │ │ │ ├── 10.jpeg │ │ │ └── Contents.json │ │ ├── 11.imageset │ │ │ ├── 11.jpeg │ │ │ └── Contents.json │ │ ├── 12.imageset │ │ │ ├── 12.jpeg │ │ │ └── Contents.json │ │ ├── 13.imageset │ │ │ ├── 13.jpeg │ │ │ └── Contents.json │ │ ├── 14.imageset │ │ │ ├── 14.png │ │ │ └── Contents.json │ │ ├── 15.imageset │ │ │ ├── 15.png │ │ │ └── Contents.json │ │ ├── 16.imageset │ │ │ ├── 16.png │ │ │ └── Contents.json │ │ └── 17.imageset │ │ │ ├── 17.jpg │ │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── HomeTableViewCell.swift ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── AppDelegate.swift ├── ViewController.swift └── HomeTableViewCell.xib ├── Pods ├── Target Support Files │ ├── SDWebImage │ │ ├── SDWebImage.modulemap │ │ ├── SDWebImage-dummy.m │ │ ├── SDWebImage-prefix.pch │ │ ├── SDWebImage.xcconfig │ │ ├── Info.plist │ │ └── SDWebImage-umbrella.h │ └── Pods-Dynamic-Image-Height │ │ ├── Pods-Dynamic-Image-Height.modulemap │ │ ├── Pods-Dynamic-Image-Height-dummy.m │ │ ├── Pods-Dynamic-Image-Height-umbrella.h │ │ ├── Pods-Dynamic-Image-Height.debug.xcconfig │ │ ├── Pods-Dynamic-Image-Height.release.xcconfig │ │ ├── Info.plist │ │ ├── Pods-Dynamic-Image-Height-acknowledgements.markdown │ │ ├── Pods-Dynamic-Image-Height-acknowledgements.plist │ │ ├── Pods-Dynamic-Image-Height-frameworks.sh │ │ └── Pods-Dynamic-Image-Height-resources.sh ├── Manifest.lock ├── SDWebImage │ ├── SDWebImage │ │ ├── SDWebImageOperation.h │ │ ├── NSImage+WebCache.h │ │ ├── UIImage+MultiFormat.h │ │ ├── SDWebImageDecoder.h │ │ ├── UIImage+GIF.h │ │ ├── NSImage+WebCache.m │ │ ├── SDImageCacheConfig.m │ │ ├── NSData+ImageContentType.h │ │ ├── UIView+WebCacheOperation.h │ │ ├── SDImageCacheConfig.h │ │ ├── NSData+ImageContentType.m │ │ ├── UIImage+GIF.m │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIView+WebCacheOperation.m │ │ ├── SDWebImageCompat.m │ │ ├── UIView+WebCache.h │ │ ├── SDWebImageCompat.h │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImagePrefetcher.m │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImageView+WebCache.m │ │ ├── UIButton+WebCache.m │ │ ├── UIView+WebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── SDImageCache.h │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageManager.h │ │ ├── UIButton+WebCache.h │ │ └── SDWebImageDecoder.m │ ├── LICENSE │ └── README.md └── Pods.xcodeproj │ └── xcuserdata │ └── abhcommon.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ ├── SDWebImage.xcscheme │ └── Pods-Dynamic-Image-Height.xcscheme ├── Dynamic-Image-Height.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── abhcommon.xcuserdatad │ │ └── IDEFindNavigatorScopes.plist └── xcuserdata │ └── abhcommon.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Dynamic-Image-Height.xcworkspace └── contents.xcworkspacedata ├── Podfile.lock ├── Podfile └── README.md /Dynamic-Image-Height/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/1.imageset/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/1.imageset/1.jpg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/2.imageset/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/2.imageset/2.jpg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/3.imageset/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/3.imageset/3.jpg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/4.imageset/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/4.imageset/4.jpg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/5.imageset/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/5.imageset/5.png -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/6.imageset/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/6.imageset/6.jpg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/7.imageset/7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/7.imageset/7.jpeg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/8.imageset/8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/8.imageset/8.jpeg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/9.imageset/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/9.imageset/9.jpg -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/10.imageset/10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/10.imageset/10.jpeg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/11.imageset/11.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/11.imageset/11.jpeg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/12.imageset/12.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/12.imageset/12.jpeg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/13.imageset/13.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/13.imageset/13.jpeg -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/14.imageset/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/14.imageset/14.png -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/15.imageset/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/15.imageset/15.png -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/16.imageset/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/16.imageset/16.png -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/17.imageset/17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janeshsutharios/DynamicImageHeight/HEAD/Dynamic-Image-Height/Assets.xcassets/salman khan/17.imageset/17.jpg -------------------------------------------------------------------------------- /Dynamic-Image-Height/HomeTableViewCell.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | class HomeTableViewCell: UITableViewCell { 3 | @IBOutlet weak var feedImageHeightConstraint: NSLayoutConstraint! 4 | @IBOutlet weak var feedImageView: UIImageView! 5 | } 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Dynamic_Image_Height { 2 | umbrella header "Pods-Dynamic-Image-Height-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Dynamic_Image_Height : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Dynamic_Image_Height 5 | @end 6 | -------------------------------------------------------------------------------- /Dynamic-Image-Height.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Dynamic-Image-Height.xcodeproj/project.xcworkspace/xcuserdata/abhcommon.xcuserdatad/IDEFindNavigatorScopes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Dynamic-Image-Height.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SDWebImage (4.1.0): 3 | - SDWebImage/Core (= 4.1.0) 4 | - SDWebImage/Core (4.1.0) 5 | 6 | DEPENDENCIES: 7 | - SDWebImage (~> 4.0) 8 | 9 | SPEC CHECKSUMS: 10 | SDWebImage: 0e435c14e402a6730315a0fb79f95e68654d55a4 11 | 12 | PODFILE CHECKSUM: c817627643032c24ef366001f277a83a20aa2fc2 13 | 14 | COCOAPODS: 1.3.1 15 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SDWebImage (4.1.0): 3 | - SDWebImage/Core (= 4.1.0) 4 | - SDWebImage/Core (4.1.0) 5 | 6 | DEPENDENCIES: 7 | - SDWebImage (~> 4.0) 8 | 9 | SPEC CHECKSUMS: 10 | SDWebImage: 0e435c14e402a6730315a0fb79f95e68654d55a4 11 | 12 | PODFILE CHECKSUM: c817627643032c24ef366001f277a83a20aa2fc2 13 | 14 | COCOAPODS: 1.3.1 15 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Dynamic-Image-Height' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | pod 'SDWebImage', '~> 4.0' 8 | 9 | 10 | # Pods for Dynamic-Image-Height 11 | 12 | end 13 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "9.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "10.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/11.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "11.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "12.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/13.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "13.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/14.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "14.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/15.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "15.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/16.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "16.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/salman khan/17.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "17.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height.xcodeproj/xcuserdata/abhcommon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Dynamic-Image-Height.xcscheme 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_Dynamic_Image_HeightVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Dynamic_Image_HeightVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | @interface NSImage (WebCache) 16 | 17 | - (CGImageRef)CGImage; 18 | - (NSArray *)images; 19 | - (BOOL)isGIF; 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_LDFLAGS = -framework "ImageIO" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "NSData+ImageContentType.h" 11 | 12 | @interface UIImage (MultiFormat) 13 | 14 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 15 | - (nullable NSData *)sd_imageData; 16 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) james 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | @interface UIImage (ForceDecode) 14 | 15 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; 16 | 17 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface UIImage (GIF) 13 | 14 | /** 15 | * Compatibility method - creates an animated UIImage from an NSData, it will only contain the 1st frame image 16 | */ 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 18 | 19 | /** 20 | * Checks if an UIImage instance is a GIF. Will use the `images` array 21 | */ 22 | - (BOOL)isGIF; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/abhcommon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-Dynamic-Image-Height.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | SDWebImage.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | 22 | SuppressBuildableAutocreation 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSImage+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSImage+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSImage (WebCache) 14 | 15 | - (CGImageRef)CGImage { 16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; 18 | return cgImage; 19 | } 20 | 21 | - (NSArray *)images { 22 | return nil; 23 | } 24 | 25 | - (BOOL)isGIF { 26 | return NO; 27 | } 28 | 29 | @end 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCacheConfig.h" 10 | 11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week 12 | 13 | @implementation SDImageCacheConfig 14 | 15 | - (instancetype)init { 16 | if (self = [super init]) { 17 | _shouldDecompressImages = YES; 18 | _shouldDisableiCloud = YES; 19 | _shouldCacheImagesInMemory = YES; 20 | _maxCacheAge = kDefaultCacheMaxCacheAge; 21 | _maxCacheSize = 0; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | typedef NS_ENUM(NSInteger, SDImageFormat) { 14 | SDImageFormatUndefined = -1, 15 | SDImageFormatJPEG = 0, 16 | SDImageFormatPNG, 17 | SDImageFormatGIF, 18 | SDImageFormatTIFF, 19 | SDImageFormatWebP 20 | }; 21 | 22 | @interface NSData (ImageContentType) 23 | 24 | /** 25 | * Return image format 26 | * 27 | * @param data the input image data 28 | * 29 | * @return the image format as `SDImageFormat` (enum) 30 | */ 31 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "NSData+ImageContentType.h" 14 | #import "NSImage+WebCache.h" 15 | #import "SDImageCache.h" 16 | #import "SDImageCacheConfig.h" 17 | #import "SDWebImageCompat.h" 18 | #import "SDWebImageDecoder.h" 19 | #import "SDWebImageDownloader.h" 20 | #import "SDWebImageDownloaderOperation.h" 21 | #import "SDWebImageManager.h" 22 | #import "SDWebImageOperation.h" 23 | #import "SDWebImagePrefetcher.h" 24 | #import "UIButton+WebCache.h" 25 | #import "UIImage+GIF.h" 26 | #import "UIImage+MultiFormat.h" 27 | #import "UIImageView+HighlightedWebCache.h" 28 | #import "UIImageView+WebCache.h" 29 | #import "UIView+WebCache.h" 30 | #import "UIView+WebCacheOperation.h" 31 | 32 | FOUNDATION_EXPORT double SDWebImageVersionNumber; 33 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; 34 | 35 | -------------------------------------------------------------------------------- /Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | @interface UIView (WebCacheOperation) 16 | 17 | /** 18 | * Set the image load operation (storage in a UIView based dictionary) 19 | * 20 | * @param operation the operation 21 | * @param key key for storing the operation 22 | */ 23 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 24 | 25 | /** 26 | * Cancel all operations for the current UIView and key 27 | * 28 | * @param key key for identifying the operations 29 | */ 30 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 31 | 32 | /** 33 | * Just remove the operations corresponding to the current UIView and key without cancelling them 34 | * 35 | * @param key key for identifying the operations 36 | */ 37 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface SDImageCacheConfig : NSObject 13 | 14 | /** 15 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 16 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 17 | */ 18 | @property (assign, nonatomic) BOOL shouldDecompressImages; 19 | 20 | /** 21 | * disable iCloud backup [defaults to YES] 22 | */ 23 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 24 | 25 | /** 26 | * use memory cache [defaults to YES] 27 | */ 28 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 29 | 30 | /** 31 | * The maximum length of time to keep an image in the cache, in seconds 32 | */ 33 | @property (assign, nonatomic) NSInteger maxCacheAge; 34 | 35 | /** 36 | * The maximum size of the cache, in bytes. 37 | */ 38 | @property (assign, nonatomic) NSUInteger maxCacheSize; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## SDWebImage 5 | 6 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is furnished 13 | to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | Generated by CocoaPods - https://cocoapods.org 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dynamic image height for ios Swift 3 & 4 2 | DynamicImageHeight is simple light weight for setting up dynamically image height 3 | 4 |

5 | 6 | ## Features 7 | 8 | - You can use either with static image or with URL using SDWebImage. 9 | ``` 10 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 11 | 12 | let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! HomeTableViewCell 13 | cell.selectionStyle = .none 14 | let image = UIImage(named:"\(indexPath.row+1)") 15 | cell.feedImageView.image = image 16 | 17 | var cellFrame = cell.frame.size 18 | cellFrame.height = cellFrame.height - 15 19 | cellFrame.width = cellFrame.width - 15 20 | cell.feedImageHeightConstraint.constant = self.getAspectRatioAccordingToiPhones(cellImageFrame: cellFrame,downloadedImage: image!) 21 | // let url = URL(string: feedModel[indexPath.row].imageModel[0].standardResolutionUrl!) 22 | // cell.feedImageView.sd_setImage(with: url, placeholderImage: nil, options: [], completed: { (theImage, error, cache, url) in 23 | // cell.feedImageHeightConstraint.constant = self.getAspectRatioAccordingToiPhones(cellImageFrame: cellFrame,downloadedImage: theImage!) 24 | // 25 | // }) 26 | return cell 27 | } 28 | ``` 29 | 30 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "NSData+ImageContentType.h" 11 | 12 | 13 | @implementation NSData (ImageContentType) 14 | 15 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { 16 | if (!data) { 17 | return SDImageFormatUndefined; 18 | } 19 | 20 | uint8_t c; 21 | [data getBytes:&c length:1]; 22 | switch (c) { 23 | case 0xFF: 24 | return SDImageFormatJPEG; 25 | case 0x89: 26 | return SDImageFormatPNG; 27 | case 0x47: 28 | return SDImageFormatGIF; 29 | case 0x49: 30 | case 0x4D: 31 | return SDImageFormatTIFF; 32 | case 0x52: 33 | // R as RIFF for WEBP 34 | if (data.length < 12) { 35 | return SDImageFormatUndefined; 36 | } 37 | 38 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 39 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 40 | return SDImageFormatWebP; 41 | } 42 | } 43 | return SDImageFormatUndefined; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "UIImage+GIF.h" 11 | #import 12 | #import "objc/runtime.h" 13 | #import "NSImage+WebCache.h" 14 | 15 | @implementation UIImage (GIF) 16 | 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 18 | if (!data) { 19 | return nil; 20 | } 21 | 22 | #if SD_MAC 23 | return [[UIImage alloc] initWithData:data]; 24 | #endif 25 | 26 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); 27 | 28 | size_t count = CGImageSourceGetCount(source); 29 | 30 | UIImage *staticImage; 31 | 32 | if (count <= 1) { 33 | staticImage = [[UIImage alloc] initWithData:data]; 34 | } else { 35 | // we will only retrieve the 1st frame. the full GIF support is available via the FLAnimatedImageView category. 36 | // this here is only code to allow drawing animated images as static ones 37 | #if SD_WATCH 38 | CGFloat scale = 1; 39 | scale = [WKInterfaceDevice currentDevice].screenScale; 40 | #elif SD_UIKIT 41 | CGFloat scale = 1; 42 | scale = [UIScreen mainScreen].scale; 43 | #endif 44 | 45 | CGImageRef CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); 46 | #if SD_UIKIT || SD_WATCH 47 | UIImage *frameImage = [UIImage imageWithCGImage:CGImage scale:scale orientation:UIImageOrientationUp]; 48 | staticImage = [UIImage animatedImageWithImages:@[frameImage] duration:0.0f]; 49 | #endif 50 | CGImageRelease(CGImage); 51 | } 52 | 53 | CFRelease(source); 54 | 55 | return staticImage; 56 | } 57 | 58 | - (BOOL)isGIF { 59 | return (self.images != nil); 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Dynamic-Image-Height/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import UIKit 4 | 5 | @UIApplicationMain 6 | class AppDelegate: UIResponder, UIApplicationDelegate { 7 | 8 | var window: UIWindow? 9 | 10 | 11 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 12 | // Override point for customization after application launch. 13 | return true 14 | } 15 | 16 | func applicationWillResignActive(_ application: UIApplication) { 17 | // 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. 18 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 19 | } 20 | 21 | func applicationDidEnterBackground(_ application: UIApplication) { 22 | // 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. 23 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 24 | } 25 | 26 | func applicationWillEnterForeground(_ application: UIApplication) { 27 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 28 | } 29 | 30 | func applicationDidBecomeActive(_ application: UIApplication) { 31 | // 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. 32 | } 33 | 34 | func applicationWillTerminate(_ application: UIApplication) { 35 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 36 | } 37 | 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+HighlightedWebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "UIView+WebCacheOperation.h" 14 | #import "UIView+WebCache.h" 15 | 16 | @implementation UIImageView (HighlightedWebCache) 17 | 18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { 19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 20 | } 21 | 22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { 23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 28 | } 29 | 30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 32 | } 33 | 34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 35 | options:(SDWebImageOptions)options 36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 37 | completed:(nullable SDExternalCompletionBlock)completedBlock { 38 | __weak typeof(self)weakSelf = self; 39 | [self sd_internalSetImageWithURL:url 40 | placeholderImage:nil 41 | options:options 42 | operationKey:@"UIImageViewImageOperationHighlighted" 43 | setImageBlock:^(UIImage *image, NSData *imageData) { 44 | weakSelf.highlightedImage = image; 45 | } 46 | progress:progressBlock 47 | completed:completedBlock]; 48 | } 49 | 50 | @end 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/abhcommon.xcuserdatad/xcschemes/SDWebImage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is furnished 24 | to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in all 27 | copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | 38 | License 39 | MIT 40 | Title 41 | SDWebImage 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Generated by CocoaPods - https://cocoapods.org 48 | Title 49 | 50 | Type 51 | PSGroupSpecifier 52 | 53 | 54 | StringsTable 55 | Acknowledgements 56 | Title 57 | Acknowledgements 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIView+WebCacheOperation.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | 15 | static char loadOperationKey; 16 | 17 | typedef NSMutableDictionary SDOperationsDictionary; 18 | 19 | @implementation UIView (WebCacheOperation) 20 | 21 | - (SDOperationsDictionary *)operationDictionary { 22 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 23 | if (operations) { 24 | return operations; 25 | } 26 | operations = [NSMutableDictionary dictionary]; 27 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return operations; 29 | } 30 | 31 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { 32 | if (key) { 33 | [self sd_cancelImageLoadOperationWithKey:key]; 34 | if (operation) { 35 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 36 | operationDictionary[key] = operation; 37 | } 38 | } 39 | } 40 | 41 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { 42 | // Cancel in progress downloader from queue 43 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 44 | id operations = operationDictionary[key]; 45 | if (operations) { 46 | if ([operations isKindOfClass:[NSArray class]]) { 47 | for (id operation in operations) { 48 | if (operation) { 49 | [operation cancel]; 50 | } 51 | } 52 | } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){ 53 | [(id) operations cancel]; 54 | } 55 | [operationDictionary removeObjectForKey:key]; 56 | } 57 | } 58 | 59 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { 60 | if (key) { 61 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 62 | [operationDictionary removeObjectForKey:key]; 63 | } 64 | } 65 | 66 | @end 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #import "objc/runtime.h" 12 | 13 | #if !__has_feature(objc_arc) 14 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 15 | #endif 16 | 17 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { 18 | if (!image) { 19 | return nil; 20 | } 21 | 22 | #if SD_MAC 23 | return image; 24 | #elif SD_UIKIT || SD_WATCH 25 | if ((image.images).count > 0) { 26 | NSMutableArray *scaledImages = [NSMutableArray array]; 27 | 28 | for (UIImage *tempImage in image.images) { 29 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 30 | } 31 | 32 | UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 33 | #ifdef SD_WEBP 34 | if (animatedImage) { 35 | SEL sd_webpLoopCount = NSSelectorFromString(@"sd_webpLoopCount"); 36 | NSNumber *value = objc_getAssociatedObject(image, sd_webpLoopCount); 37 | NSInteger loopCount = value.integerValue; 38 | if (loopCount) { 39 | objc_setAssociatedObject(animatedImage, sd_webpLoopCount, @(loopCount), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 40 | } 41 | } 42 | #endif 43 | return animatedImage; 44 | } else { 45 | #if SD_WATCH 46 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { 47 | #elif SD_UIKIT 48 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 49 | #endif 50 | CGFloat scale = 1; 51 | if (key.length >= 8) { 52 | NSRange range = [key rangeOfString:@"@2x."]; 53 | if (range.location != NSNotFound) { 54 | scale = 2.0; 55 | } 56 | 57 | range = [key rangeOfString:@"@3x."]; 58 | if (range.location != NSNotFound) { 59 | scale = 3.0; 60 | } 61 | } 62 | 63 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 64 | image = scaledImage; 65 | } 66 | return image; 67 | } 68 | #endif 69 | } 70 | 71 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 72 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SDWebImage 3 | class ViewController: UIViewController { 4 | @IBOutlet weak var tableViewHome :UITableView! 5 | override func viewDidLoad() { 6 | tableViewHome.register(UINib(nibName:"HomeTableViewCell",bundle:nil), forCellReuseIdentifier: "cell") 7 | tableViewHome.estimatedRowHeight = 400 8 | tableViewHome.rowHeight = UITableViewAutomaticDimension 9 | } 10 | } 11 | // MARK: TableView datasource delegate 12 | extension ViewController :UITableViewDataSource,UITableViewDelegate{ 13 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 14 | return 17 15 | } 16 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 17 | 18 | let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! HomeTableViewCell 19 | cell.selectionStyle = .none 20 | let image = UIImage(named:"\(indexPath.row+1)") 21 | cell.feedImageView.image = image 22 | 23 | var cellFrame = cell.frame.size 24 | cellFrame.height = cellFrame.height - 15 25 | cellFrame.width = cellFrame.width - 15 26 | cell.feedImageHeightConstraint.constant = self.getAspectRatioAccordingToiPhones(cellImageFrame: cellFrame,downloadedImage: image!) 27 | // let url = URL(string: feedModel[indexPath.row].imageModel[0].standardResolutionUrl!) 28 | // cell.feedImageView.sd_setImage(with: url, placeholderImage: nil, options: [], completed: { (theImage, error, cache, url) in 29 | // cell.feedImageHeightConstraint.constant = self.getAspectRatioAccordingToiPhones(cellImageFrame: cellFrame,downloadedImage: theImage!) 30 | // 31 | // }) 32 | return cell 33 | } 34 | func getAspectRatioAccordingToiPhones(cellImageFrame:CGSize,downloadedImage: UIImage)->CGFloat { 35 | let widthOffset = downloadedImage.size.width - cellImageFrame.width 36 | let widthOffsetPercentage = (widthOffset*100)/downloadedImage.size.width 37 | let heightOffset = (widthOffsetPercentage * downloadedImage.size.height)/100 38 | let effectiveHeight = downloadedImage.size.height - heightOffset 39 | return(effectiveHeight) 40 | } 41 | // MARK: Optional function for resize of image 42 | func resizeHighImage(image:UIImage)->UIImage { 43 | let size = image.size.applying(CGAffineTransform(scaleX: 0.5, y: 0.5)) 44 | let hasAlpha = false 45 | let scale: CGFloat = 0.0 // Automatically use scale factor of main screen 46 | UIGraphicsBeginImageContextWithOptions(size, !hasAlpha, scale) 47 | image.draw(in: CGRect(origin: .zero, size: size)) 48 | let scaledImage = UIGraphicsGetImageFromCurrentImageContext() 49 | UIGraphicsEndImageContext() 50 | return scaledImage! 51 | 52 | } 53 | } 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/abhcommon.xcuserdatad/xcschemes/Pods-Dynamic-Image-Height.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 68 | 69 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIView+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData); 16 | 17 | @interface UIView (WebCache) 18 | 19 | /** 20 | * Get the current image URL. 21 | * 22 | * Note that because of the limitations of categories this property can get out of sync 23 | * if you use setImage: directly. 24 | */ 25 | - (nullable NSURL *)sd_imageURL; 26 | 27 | /** 28 | * Set the imageView `image` with an `url` and optionally a placeholder image. 29 | * 30 | * The download is asynchronous and cached. 31 | * 32 | * @param url The url for the image. 33 | * @param placeholder The image to be set initially, until the image request finishes. 34 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 35 | * @param operationKey A string to be used as the operation key. If nil, will use the class name 36 | * @param setImageBlock Block used for custom set image code 37 | * @param progressBlock A block called while image is downloading 38 | * @note the progress block is executed on a background queue 39 | * @param completedBlock A block called when operation has been completed. This block has no return value 40 | * and takes the requested UIImage as first parameter. In case of error the image parameter 41 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 42 | * indicating if the image was retrieved from the local cache or from the network. 43 | * The fourth parameter is the original image url. 44 | */ 45 | - (void)sd_internalSetImageWithURL:(nullable NSURL *)url 46 | placeholderImage:(nullable UIImage *)placeholder 47 | options:(SDWebImageOptions)options 48 | operationKey:(nullable NSString *)operationKey 49 | setImageBlock:(nullable SDSetImageBlock)setImageBlock 50 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 51 | completed:(nullable SDExternalCompletionBlock)completedBlock; 52 | 53 | /** 54 | * Cancel the current download 55 | */ 56 | - (void)sd_cancelCurrentImageLoad; 57 | 58 | #if SD_UIKIT 59 | 60 | #pragma mark - Activity indicator 61 | 62 | /** 63 | * Show activity UIActivityIndicatorView 64 | */ 65 | - (void)sd_setShowActivityIndicatorView:(BOOL)show; 66 | 67 | /** 68 | * set desired UIActivityIndicatorViewStyle 69 | * 70 | * @param style The style of the UIActivityIndicatorView 71 | */ 72 | - (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style; 73 | 74 | - (BOOL)sd_showActivityIndicatorView; 75 | - (void)sd_addActivityIndicator; 76 | - (void)sd_removeActivityIndicator; 77 | 78 | #endif 79 | 80 | @end 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | // Apple's defines from TargetConditionals.h are a bit weird. 17 | // Seems like TARGET_OS_MAC is always defined (on all platforms). 18 | // To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms 19 | #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH 20 | #define SD_MAC 1 21 | #else 22 | #define SD_MAC 0 23 | #endif 24 | 25 | // iOS and tvOS are very similar, UIKit exists on both platforms 26 | // Note: watchOS also has UIKit, but it's very limited 27 | #if TARGET_OS_IOS || TARGET_OS_TV 28 | #define SD_UIKIT 1 29 | #else 30 | #define SD_UIKIT 0 31 | #endif 32 | 33 | #if TARGET_OS_IOS 34 | #define SD_IOS 1 35 | #else 36 | #define SD_IOS 0 37 | #endif 38 | 39 | #if TARGET_OS_TV 40 | #define SD_TV 1 41 | #else 42 | #define SD_TV 0 43 | #endif 44 | 45 | #if TARGET_OS_WATCH 46 | #define SD_WATCH 1 47 | #else 48 | #define SD_WATCH 0 49 | #endif 50 | 51 | 52 | #if SD_MAC 53 | #import 54 | #ifndef UIImage 55 | #define UIImage NSImage 56 | #endif 57 | #ifndef UIImageView 58 | #define UIImageView NSImageView 59 | #endif 60 | #ifndef UIView 61 | #define UIView NSView 62 | #endif 63 | #else 64 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 65 | #error SDWebImage doesn't support Deployment Target version < 5.0 66 | #endif 67 | 68 | #if SD_UIKIT 69 | #import 70 | #endif 71 | #if SD_WATCH 72 | #import 73 | #endif 74 | #endif 75 | 76 | #ifndef NS_ENUM 77 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 78 | #endif 79 | 80 | #ifndef NS_OPTIONS 81 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 82 | #endif 83 | 84 | #if OS_OBJECT_USE_OBJC 85 | #undef SDDispatchQueueRelease 86 | #undef SDDispatchQueueSetterSementics 87 | #define SDDispatchQueueRelease(q) 88 | #define SDDispatchQueueSetterSementics strong 89 | #else 90 | #undef SDDispatchQueueRelease 91 | #undef SDDispatchQueueSetterSementics 92 | #define SDDispatchQueueRelease(q) (dispatch_release(q)) 93 | #define SDDispatchQueueSetterSementics assign 94 | #endif 95 | 96 | extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 97 | 98 | typedef void(^SDWebImageNoParamsBlock)(); 99 | 100 | extern NSString *const SDWebImageErrorDomain; 101 | 102 | #ifndef dispatch_main_async_safe 103 | #define dispatch_main_async_safe(block)\ 104 | if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) {\ 105 | block();\ 106 | } else {\ 107 | dispatch_async(dispatch_get_main_queue(), block);\ 108 | } 109 | #endif 110 | 111 | static int64_t kAsyncTestTimeout = 5; 112 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/HomeTableViewCell.xib: -------------------------------------------------------------------------------- 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 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Dynamic-Image-Height/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 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 17 | */ 18 | @interface UIImageView (HighlightedWebCache) 19 | 20 | /** 21 | * Set the imageView `highlightedImage` with an `url`. 22 | * 23 | * The download is asynchronous and cached. 24 | * 25 | * @param url The url for the image. 26 | */ 27 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; 28 | 29 | /** 30 | * Set the imageView `highlightedImage` with an `url` and custom options. 31 | * 32 | * The download is asynchronous and cached. 33 | * 34 | * @param url The url for the image. 35 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 36 | */ 37 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 38 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 39 | 40 | /** 41 | * Set the imageView `highlightedImage` with an `url`. 42 | * 43 | * The download is asynchronous and cached. 44 | * 45 | * @param url The url for the image. 46 | * @param completedBlock A block called when operation has been completed. This block has no return value 47 | * and takes the requested UIImage as first parameter. In case of error the image parameter 48 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 49 | * indicating if the image was retrieved from the local cache or from the network. 50 | * The fourth parameter is the original image url. 51 | */ 52 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 53 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 54 | 55 | /** 56 | * Set the imageView `highlightedImage` with an `url` and custom options. 57 | * 58 | * The download is asynchronous and cached. 59 | * 60 | * @param url The url for the image. 61 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 62 | * @param completedBlock A block called when operation has been completed. This block has no return value 63 | * and takes the requested UIImage as first parameter. In case of error the image parameter 64 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 65 | * indicating if the image was retrieved from the local cache or from the network. 66 | * The fourth parameter is the original image url. 67 | */ 68 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 69 | options:(SDWebImageOptions)options 70 | completed:(nullable SDExternalCompletionBlock)completedBlock; 71 | 72 | /** 73 | * Set the imageView `highlightedImage` with an `url` and custom options. 74 | * 75 | * The download is asynchronous and cached. 76 | * 77 | * @param url The url for the image. 78 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 79 | * @param progressBlock A block called while image is downloading 80 | * @note the progress block is executed on a background queue 81 | * @param completedBlock A block called when operation has been completed. This block has no return value 82 | * and takes the requested UIImage as first parameter. In case of error the image parameter 83 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 84 | * indicating if the image was retrieved from the local cache or from the network. 85 | * The fourth parameter is the original image url. 86 | */ 87 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 88 | options:(SDWebImageOptions)options 89 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 90 | completed:(nullable SDExternalCompletionBlock)completedBlock; 91 | 92 | @end 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched (successful or not) 24 | * @param totalCount The total number of images that were to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; 27 | 28 | /** 29 | * Called when all images are prefetched. 30 | * @param imagePrefetcher The current image prefetcher 31 | * @param totalCount The total number of images that were prefetched (whether successful or not) 32 | * @param skippedCount The total number of images that were skipped 33 | */ 34 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; 35 | 36 | @end 37 | 38 | typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); 39 | typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); 40 | 41 | /** 42 | * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. 43 | */ 44 | @interface SDWebImagePrefetcher : NSObject 45 | 46 | /** 47 | * The web image manager 48 | */ 49 | @property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; 50 | 51 | /** 52 | * Maximum number of URLs to prefetch at the same time. Defaults to 3. 53 | */ 54 | @property (nonatomic, assign) NSUInteger maxConcurrentDownloads; 55 | 56 | /** 57 | * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. 58 | */ 59 | @property (nonatomic, assign) SDWebImageOptions options; 60 | 61 | /** 62 | * Queue options for Prefetcher. Defaults to Main Queue. 63 | */ 64 | @property (SDDispatchQueueSetterSementics, nonatomic, nonnull) dispatch_queue_t prefetcherQueue; 65 | 66 | @property (weak, nonatomic, nullable) id delegate; 67 | 68 | /** 69 | * Return the global image prefetcher instance. 70 | */ 71 | + (nonnull instancetype)sharedImagePrefetcher; 72 | 73 | /** 74 | * Allows you to instantiate a prefetcher with any arbitrary image manager. 75 | */ 76 | - (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; 77 | 78 | /** 79 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 80 | * currently one image is downloaded at a time, 81 | * and skips images for failed downloads and proceed to the next image in the list. 82 | * Any previously-running prefetch operations are canceled. 83 | * 84 | * @param urls list of URLs to prefetch 85 | */ 86 | - (void)prefetchURLs:(nullable NSArray *)urls; 87 | 88 | /** 89 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 90 | * currently one image is downloaded at a time, 91 | * and skips images for failed downloads and proceed to the next image in the list. 92 | * Any previously-running prefetch operations are canceled. 93 | * 94 | * @param urls list of URLs to prefetch 95 | * @param progressBlock block to be called when progress updates; 96 | * first parameter is the number of completed (successful or not) requests, 97 | * second parameter is the total number of images originally requested to be prefetched 98 | * @param completionBlock block to be called when prefetching is completed 99 | * first param is the number of completed (successful or not) requests, 100 | * second parameter is the number of skipped requests 101 | */ 102 | - (void)prefetchURLs:(nullable NSArray *)urls 103 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 104 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; 105 | 106 | /** 107 | * Remove and cancel queued list 108 | */ 109 | - (void)cancelPrefetching; 110 | 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageDownloader.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | extern NSString * _Nonnull const SDWebImageDownloadStartNotification; 14 | extern NSString * _Nonnull const SDWebImageDownloadReceiveResponseNotification; 15 | extern NSString * _Nonnull const SDWebImageDownloadStopNotification; 16 | extern NSString * _Nonnull const SDWebImageDownloadFinishNotification; 17 | 18 | 19 | 20 | /** 21 | Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol 22 | */ 23 | @protocol SDWebImageDownloaderOperationInterface 24 | 25 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 26 | inSession:(nullable NSURLSession *)session 27 | options:(SDWebImageDownloaderOptions)options; 28 | 29 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 30 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 31 | 32 | - (BOOL)shouldDecompressImages; 33 | - (void)setShouldDecompressImages:(BOOL)value; 34 | 35 | - (nullable NSURLCredential *)credential; 36 | - (void)setCredential:(nullable NSURLCredential *)value; 37 | 38 | @end 39 | 40 | 41 | @interface SDWebImageDownloaderOperation : NSOperation 42 | 43 | /** 44 | * The request used by the operation's task. 45 | */ 46 | @property (strong, nonatomic, readonly, nullable) NSURLRequest *request; 47 | 48 | /** 49 | * The operation's task 50 | */ 51 | @property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; 52 | 53 | 54 | @property (assign, nonatomic) BOOL shouldDecompressImages; 55 | 56 | /** 57 | * Was used to determine whether the URL connection should consult the credential storage for authenticating the connection. 58 | * @deprecated Not used for a couple of versions 59 | */ 60 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility"); 61 | 62 | /** 63 | * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. 64 | * 65 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 66 | */ 67 | @property (nonatomic, strong, nullable) NSURLCredential *credential; 68 | 69 | /** 70 | * The SDWebImageDownloaderOptions for the receiver. 71 | */ 72 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 73 | 74 | /** 75 | * The expected size of data. 76 | */ 77 | @property (assign, nonatomic) NSInteger expectedSize; 78 | 79 | /** 80 | * The response returned by the operation's connection. 81 | */ 82 | @property (strong, nonatomic, nullable) NSURLResponse *response; 83 | 84 | /** 85 | * Initializes a `SDWebImageDownloaderOperation` object 86 | * 87 | * @see SDWebImageDownloaderOperation 88 | * 89 | * @param request the URL request 90 | * @param session the URL session in which this operation will run 91 | * @param options downloader options 92 | * 93 | * @return the initialized instance 94 | */ 95 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 96 | inSession:(nullable NSURLSession *)session 97 | options:(SDWebImageDownloaderOptions)options NS_DESIGNATED_INITIALIZER; 98 | 99 | /** 100 | * Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of 101 | * callbacks. 102 | * 103 | * @param progressBlock the block executed when a new chunk of data arrives. 104 | * @note the progress block is executed on a background queue 105 | * @param completedBlock the block executed when the download is done. 106 | * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue 107 | * 108 | * @return the token to use to cancel this set of handlers 109 | */ 110 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 111 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 112 | 113 | /** 114 | * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. 115 | * 116 | * @param token the token representing a set of callbacks to cancel 117 | * 118 | * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. 119 | */ 120 | - (BOOL)cancel:(nullable id)token; 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 10 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 11 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 12 | 13 | install_framework() 14 | { 15 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 16 | local source="${BUILT_PRODUCTS_DIR}/$1" 17 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 18 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 19 | elif [ -r "$1" ]; then 20 | local source="$1" 21 | fi 22 | 23 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 24 | 25 | if [ -L "${source}" ]; then 26 | echo "Symlinked..." 27 | source="$(readlink "${source}")" 28 | fi 29 | 30 | # Use filter instead of exclude so missing patterns don't throw errors. 31 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 32 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 33 | 34 | local basename 35 | basename="$(basename -s .framework "$1")" 36 | binary="${destination}/${basename}.framework/${basename}" 37 | if ! [ -r "$binary" ]; then 38 | binary="${destination}/${basename}" 39 | fi 40 | 41 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 42 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 43 | strip_invalid_archs "$binary" 44 | fi 45 | 46 | # Resign the code if required by the build settings to avoid unstable apps 47 | code_sign_if_enabled "${destination}/$(basename "$1")" 48 | 49 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 50 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 51 | local swift_runtime_libs 52 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 53 | for lib in $swift_runtime_libs; do 54 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 55 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 56 | code_sign_if_enabled "${destination}/${lib}" 57 | done 58 | fi 59 | } 60 | 61 | # Copies the dSYM of a vendored framework 62 | install_dsym() { 63 | local source="$1" 64 | if [ -r "$source" ]; then 65 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\"" 66 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}" 67 | fi 68 | } 69 | 70 | # Signs a framework with the provided identity 71 | code_sign_if_enabled() { 72 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 73 | # Use the current code_sign_identitiy 74 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 75 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 76 | 77 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 78 | code_sign_cmd="$code_sign_cmd &" 79 | fi 80 | echo "$code_sign_cmd" 81 | eval "$code_sign_cmd" 82 | fi 83 | } 84 | 85 | # Strip invalid architectures 86 | strip_invalid_archs() { 87 | binary="$1" 88 | # Get architectures for current file 89 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 90 | stripped="" 91 | for arch in $archs; do 92 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 93 | # Strip non-valid architectures in-place 94 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 95 | stripped="$stripped $arch" 96 | fi 97 | done 98 | if [[ "$stripped" ]]; then 99 | echo "Stripped $binary of architectures:$stripped" 100 | fi 101 | } 102 | 103 | 104 | if [[ "$CONFIGURATION" == "Debug" ]]; then 105 | install_framework "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework" 106 | fi 107 | if [[ "$CONFIGURATION" == "Release" ]]; then 108 | install_framework "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework" 109 | fi 110 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 111 | wait 112 | fi 113 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImagePrefetcher.h" 10 | 11 | @interface SDWebImagePrefetcher () 12 | 13 | @property (strong, nonatomic, nonnull) SDWebImageManager *manager; 14 | @property (strong, nonatomic, nullable) NSArray *prefetchURLs; 15 | @property (assign, nonatomic) NSUInteger requestedCount; 16 | @property (assign, nonatomic) NSUInteger skippedCount; 17 | @property (assign, nonatomic) NSUInteger finishedCount; 18 | @property (assign, nonatomic) NSTimeInterval startedTime; 19 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; 20 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherProgressBlock progressBlock; 21 | 22 | @end 23 | 24 | @implementation SDWebImagePrefetcher 25 | 26 | + (nonnull instancetype)sharedImagePrefetcher { 27 | static dispatch_once_t once; 28 | static id instance; 29 | dispatch_once(&once, ^{ 30 | instance = [self new]; 31 | }); 32 | return instance; 33 | } 34 | 35 | - (nonnull instancetype)init { 36 | return [self initWithImageManager:[SDWebImageManager new]]; 37 | } 38 | 39 | - (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { 40 | if ((self = [super init])) { 41 | _manager = manager; 42 | _options = SDWebImageLowPriority; 43 | _prefetcherQueue = dispatch_get_main_queue(); 44 | self.maxConcurrentDownloads = 3; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { 50 | self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; 51 | } 52 | 53 | - (NSUInteger)maxConcurrentDownloads { 54 | return self.manager.imageDownloader.maxConcurrentDownloads; 55 | } 56 | 57 | - (void)startPrefetchingAtIndex:(NSUInteger)index { 58 | if (index >= self.prefetchURLs.count) return; 59 | self.requestedCount++; 60 | [self.manager loadImageWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 61 | if (!finished) return; 62 | self.finishedCount++; 63 | 64 | if (image) { 65 | if (self.progressBlock) { 66 | self.progressBlock(self.finishedCount,(self.prefetchURLs).count); 67 | } 68 | } 69 | else { 70 | if (self.progressBlock) { 71 | self.progressBlock(self.finishedCount,(self.prefetchURLs).count); 72 | } 73 | // Add last failed 74 | self.skippedCount++; 75 | } 76 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 77 | [self.delegate imagePrefetcher:self 78 | didPrefetchURL:self.prefetchURLs[index] 79 | finishedCount:self.finishedCount 80 | totalCount:self.prefetchURLs.count 81 | ]; 82 | } 83 | if (self.prefetchURLs.count > self.requestedCount) { 84 | dispatch_async(self.prefetcherQueue, ^{ 85 | [self startPrefetchingAtIndex:self.requestedCount]; 86 | }); 87 | } else if (self.finishedCount == self.requestedCount) { 88 | [self reportStatus]; 89 | if (self.completionBlock) { 90 | self.completionBlock(self.finishedCount, self.skippedCount); 91 | self.completionBlock = nil; 92 | } 93 | self.progressBlock = nil; 94 | } 95 | }]; 96 | } 97 | 98 | - (void)reportStatus { 99 | NSUInteger total = (self.prefetchURLs).count; 100 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 101 | [self.delegate imagePrefetcher:self 102 | didFinishWithTotalCount:(total - self.skippedCount) 103 | skippedCount:self.skippedCount 104 | ]; 105 | } 106 | } 107 | 108 | - (void)prefetchURLs:(nullable NSArray *)urls { 109 | [self prefetchURLs:urls progress:nil completed:nil]; 110 | } 111 | 112 | - (void)prefetchURLs:(nullable NSArray *)urls 113 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 114 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { 115 | [self cancelPrefetching]; // Prevent duplicate prefetch request 116 | self.startedTime = CFAbsoluteTimeGetCurrent(); 117 | self.prefetchURLs = urls; 118 | self.completionBlock = completionBlock; 119 | self.progressBlock = progressBlock; 120 | 121 | if (urls.count == 0) { 122 | if (completionBlock) { 123 | completionBlock(0,0); 124 | } 125 | } else { 126 | // Starts prefetching from the very first image on the list with the max allowed concurrency 127 | NSUInteger listCount = self.prefetchURLs.count; 128 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 129 | [self startPrefetchingAtIndex:i]; 130 | } 131 | } 132 | } 133 | 134 | - (void)cancelPrefetching { 135 | self.prefetchURLs = nil; 136 | self.skippedCount = 0; 137 | self.requestedCount = 0; 138 | self.finishedCount = 0; 139 | [self.manager cancelAll]; 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImage+MultiFormat.h" 10 | #import "UIImage+GIF.h" 11 | #import "NSData+ImageContentType.h" 12 | #import 13 | 14 | #ifdef SD_WEBP 15 | #import "UIImage+WebP.h" 16 | #endif 17 | 18 | @implementation UIImage (MultiFormat) 19 | 20 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { 21 | if (!data) { 22 | return nil; 23 | } 24 | 25 | UIImage *image; 26 | SDImageFormat imageFormat = [NSData sd_imageFormatForImageData:data]; 27 | if (imageFormat == SDImageFormatGIF) { 28 | image = [UIImage sd_animatedGIFWithData:data]; 29 | } 30 | #ifdef SD_WEBP 31 | else if (imageFormat == SDImageFormatWebP) 32 | { 33 | image = [UIImage sd_imageWithWebPData:data]; 34 | } 35 | #endif 36 | else { 37 | image = [[UIImage alloc] initWithData:data]; 38 | #if SD_UIKIT || SD_WATCH 39 | UIImageOrientation orientation = [self sd_imageOrientationFromImageData:data]; 40 | if (orientation != UIImageOrientationUp) { 41 | image = [UIImage imageWithCGImage:image.CGImage 42 | scale:image.scale 43 | orientation:orientation]; 44 | } 45 | #endif 46 | } 47 | 48 | 49 | return image; 50 | } 51 | 52 | #if SD_UIKIT || SD_WATCH 53 | +(UIImageOrientation)sd_imageOrientationFromImageData:(nonnull NSData *)imageData { 54 | UIImageOrientation result = UIImageOrientationUp; 55 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); 56 | if (imageSource) { 57 | CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); 58 | if (properties) { 59 | CFTypeRef val; 60 | int exifOrientation; 61 | val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); 62 | if (val) { 63 | CFNumberGetValue(val, kCFNumberIntType, &exifOrientation); 64 | result = [self sd_exifOrientationToiOSOrientation:exifOrientation]; 65 | } // else - if it's not set it remains at up 66 | CFRelease((CFTypeRef) properties); 67 | } else { 68 | //NSLog(@"NO PROPERTIES, FAIL"); 69 | } 70 | CFRelease(imageSource); 71 | } 72 | return result; 73 | } 74 | 75 | #pragma mark EXIF orientation tag converter 76 | // Convert an EXIF image orientation to an iOS one. 77 | // reference see here: http://sylvana.net/jpegcrop/exif_orientation.html 78 | + (UIImageOrientation) sd_exifOrientationToiOSOrientation:(int)exifOrientation { 79 | UIImageOrientation orientation = UIImageOrientationUp; 80 | switch (exifOrientation) { 81 | case 1: 82 | orientation = UIImageOrientationUp; 83 | break; 84 | 85 | case 3: 86 | orientation = UIImageOrientationDown; 87 | break; 88 | 89 | case 8: 90 | orientation = UIImageOrientationLeft; 91 | break; 92 | 93 | case 6: 94 | orientation = UIImageOrientationRight; 95 | break; 96 | 97 | case 2: 98 | orientation = UIImageOrientationUpMirrored; 99 | break; 100 | 101 | case 4: 102 | orientation = UIImageOrientationDownMirrored; 103 | break; 104 | 105 | case 5: 106 | orientation = UIImageOrientationLeftMirrored; 107 | break; 108 | 109 | case 7: 110 | orientation = UIImageOrientationRightMirrored; 111 | break; 112 | default: 113 | break; 114 | } 115 | return orientation; 116 | } 117 | #endif 118 | 119 | - (nullable NSData *)sd_imageData { 120 | return [self sd_imageDataAsFormat:SDImageFormatUndefined]; 121 | } 122 | 123 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { 124 | NSData *imageData = nil; 125 | if (self) { 126 | #if SD_UIKIT || SD_WATCH 127 | int alphaInfo = CGImageGetAlphaInfo(self.CGImage); 128 | BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || 129 | alphaInfo == kCGImageAlphaNoneSkipFirst || 130 | alphaInfo == kCGImageAlphaNoneSkipLast); 131 | 132 | BOOL usePNG = hasAlpha; 133 | 134 | // the imageFormat param has priority here. But if the format is undefined, we relly on the alpha channel 135 | if (imageFormat != SDImageFormatUndefined) { 136 | usePNG = (imageFormat == SDImageFormatPNG); 137 | } 138 | 139 | if (usePNG) { 140 | imageData = UIImagePNGRepresentation(self); 141 | } else { 142 | imageData = UIImageJPEGRepresentation(self, (CGFloat)1.0); 143 | } 144 | #else 145 | NSBitmapImageFileType imageFileType = NSJPEGFileType; 146 | if (imageFormat == SDImageFormatGIF) { 147 | imageFileType = NSGIFFileType; 148 | } else if (imageFormat == SDImageFormatPNG) { 149 | imageFileType = NSPNGFileType; 150 | } 151 | 152 | imageData = [NSBitmapImageRep representationOfImageRepsInArray:self.representations 153 | usingType:imageFileType 154 | properties:@{}]; 155 | #endif 156 | } 157 | return imageData; 158 | } 159 | 160 | 161 | @end 162 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+WebCache.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | @implementation UIImageView (WebCache) 18 | 19 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 20 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 21 | } 22 | 23 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 24 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 25 | } 26 | 27 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 28 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 29 | } 30 | 31 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 32 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 33 | } 34 | 35 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 36 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 37 | } 38 | 39 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 40 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 41 | } 42 | 43 | - (void)sd_setImageWithURL:(nullable NSURL *)url 44 | placeholderImage:(nullable UIImage *)placeholder 45 | options:(SDWebImageOptions)options 46 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 47 | completed:(nullable SDExternalCompletionBlock)completedBlock { 48 | [self sd_internalSetImageWithURL:url 49 | placeholderImage:placeholder 50 | options:options 51 | operationKey:nil 52 | setImageBlock:nil 53 | progress:progressBlock 54 | completed:completedBlock]; 55 | } 56 | 57 | - (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url 58 | placeholderImage:(nullable UIImage *)placeholder 59 | options:(SDWebImageOptions)options 60 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 61 | completed:(nullable SDExternalCompletionBlock)completedBlock { 62 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url]; 63 | UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromCacheForKey:key]; 64 | 65 | [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock]; 66 | } 67 | 68 | #if SD_UIKIT 69 | 70 | #pragma mark - Animation of multiple images 71 | 72 | - (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs { 73 | [self sd_cancelCurrentAnimationImagesLoad]; 74 | __weak __typeof(self)wself = self; 75 | 76 | NSMutableArray> *operationsArray = [[NSMutableArray alloc] init]; 77 | 78 | [arrayOfURLs enumerateObjectsUsingBlock:^(NSURL *logoImageURL, NSUInteger idx, BOOL * _Nonnull stop) { 79 | id operation = [SDWebImageManager.sharedManager loadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 80 | if (!wself) return; 81 | dispatch_main_async_safe(^{ 82 | __strong UIImageView *sself = wself; 83 | [sself stopAnimating]; 84 | if (sself && image) { 85 | NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; 86 | if (!currentImages) { 87 | currentImages = [[NSMutableArray alloc] init]; 88 | } 89 | 90 | // We know what index objects should be at when they are returned so 91 | // we will put the object at the index, filling any empty indexes 92 | // with the image that was returned too "early". These images will 93 | // be overwritten. (does not require additional sorting datastructure) 94 | while ([currentImages count] < idx) { 95 | [currentImages addObject:image]; 96 | } 97 | 98 | currentImages[idx] = image; 99 | 100 | sself.animationImages = currentImages; 101 | [sself setNeedsLayout]; 102 | } 103 | [sself startAnimating]; 104 | }); 105 | }]; 106 | [operationsArray addObject:operation]; 107 | }]; 108 | 109 | [self sd_setImageLoadOperation:[operationsArray copy] forKey:@"UIImageViewAnimationImages"]; 110 | } 111 | 112 | - (void)sd_cancelCurrentAnimationImagesLoad { 113 | [self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"]; 114 | } 115 | #endif 116 | 117 | @end 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Dynamic-Image-Height/Pods-Dynamic-Image-Height-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 12 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 13 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 14 | 15 | case "${TARGETED_DEVICE_FAMILY}" in 16 | 1,2) 17 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 18 | ;; 19 | 1) 20 | TARGET_DEVICE_ARGS="--target-device iphone" 21 | ;; 22 | 2) 23 | TARGET_DEVICE_ARGS="--target-device ipad" 24 | ;; 25 | 3) 26 | TARGET_DEVICE_ARGS="--target-device tv" 27 | ;; 28 | 4) 29 | TARGET_DEVICE_ARGS="--target-device watch" 30 | ;; 31 | *) 32 | TARGET_DEVICE_ARGS="--target-device mac" 33 | ;; 34 | esac 35 | 36 | install_resource() 37 | { 38 | if [[ "$1" = /* ]] ; then 39 | RESOURCE_PATH="$1" 40 | else 41 | RESOURCE_PATH="${PODS_ROOT}/$1" 42 | fi 43 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 44 | cat << EOM 45 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 46 | EOM 47 | exit 1 48 | fi 49 | case $RESOURCE_PATH in 50 | *.storyboard) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.xib) 55 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 56 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 57 | ;; 58 | *.framework) 59 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 60 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 61 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 62 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 63 | ;; 64 | *.xcdatamodel) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 67 | ;; 68 | *.xcdatamodeld) 69 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 70 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 71 | ;; 72 | *.xcmappingmodel) 73 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 74 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 75 | ;; 76 | *.xcassets) 77 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 78 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 79 | ;; 80 | *) 81 | echo "$RESOURCE_PATH" || true 82 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 83 | ;; 84 | esac 85 | } 86 | 87 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 89 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 90 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | fi 93 | rm -f "$RESOURCES_TO_COPY" 94 | 95 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 96 | then 97 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 98 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 99 | while read line; do 100 | if [[ $line != "${PODS_ROOT}*" ]]; then 101 | XCASSET_FILES+=("$line") 102 | fi 103 | done <<<"$OTHER_XCASSETS" 104 | 105 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 106 | fi 107 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIButton+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIButton+WebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | static char imageURLStorageKey; 18 | 19 | typedef NSMutableDictionary SDStateImageURLDictionary; 20 | 21 | @implementation UIButton (WebCache) 22 | 23 | - (nullable NSURL *)sd_currentImageURL { 24 | NSURL *url = self.imageURLStorage[@(self.state)]; 25 | 26 | if (!url) { 27 | url = self.imageURLStorage[@(UIControlStateNormal)]; 28 | } 29 | 30 | return url; 31 | } 32 | 33 | - (nullable NSURL *)sd_imageURLForState:(UIControlState)state { 34 | return self.imageURLStorage[@(state)]; 35 | } 36 | 37 | #pragma mark - Image 38 | 39 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { 40 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 41 | } 42 | 43 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { 44 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 45 | } 46 | 47 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 48 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 49 | } 50 | 51 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { 52 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; 53 | } 54 | 55 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 56 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; 57 | } 58 | 59 | - (void)sd_setImageWithURL:(nullable NSURL *)url 60 | forState:(UIControlState)state 61 | placeholderImage:(nullable UIImage *)placeholder 62 | options:(SDWebImageOptions)options 63 | completed:(nullable SDExternalCompletionBlock)completedBlock { 64 | if (!url) { 65 | [self.imageURLStorage removeObjectForKey:@(state)]; 66 | return; 67 | } 68 | 69 | self.imageURLStorage[@(state)] = url; 70 | 71 | __weak typeof(self)weakSelf = self; 72 | [self sd_internalSetImageWithURL:url 73 | placeholderImage:placeholder 74 | options:options 75 | operationKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)] 76 | setImageBlock:^(UIImage *image, NSData *imageData) { 77 | [weakSelf setImage:image forState:state]; 78 | } 79 | progress:nil 80 | completed:completedBlock]; 81 | } 82 | 83 | #pragma mark - Background image 84 | 85 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { 86 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 87 | } 88 | 89 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { 90 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 91 | } 92 | 93 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 94 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 95 | } 96 | 97 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { 98 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; 99 | } 100 | 101 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 102 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; 103 | } 104 | 105 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 106 | forState:(UIControlState)state 107 | placeholderImage:(nullable UIImage *)placeholder 108 | options:(SDWebImageOptions)options 109 | completed:(nullable SDExternalCompletionBlock)completedBlock { 110 | if (!url) { 111 | [self.imageURLStorage removeObjectForKey:@(state)]; 112 | return; 113 | } 114 | 115 | self.imageURLStorage[@(state)] = url; 116 | 117 | __weak typeof(self)weakSelf = self; 118 | [self sd_internalSetImageWithURL:url 119 | placeholderImage:placeholder 120 | options:options 121 | operationKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)] 122 | setImageBlock:^(UIImage *image, NSData *imageData) { 123 | [weakSelf setBackgroundImage:image forState:state]; 124 | } 125 | progress:nil 126 | completed:completedBlock]; 127 | } 128 | 129 | - (void)sd_setImageLoadOperation:(id)operation forState:(UIControlState)state { 130 | [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; 131 | } 132 | 133 | - (void)sd_cancelImageLoadForState:(UIControlState)state { 134 | [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; 135 | } 136 | 137 | - (void)sd_setBackgroundImageLoadOperation:(id)operation forState:(UIControlState)state { 138 | [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; 139 | } 140 | 141 | - (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { 142 | [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; 143 | } 144 | 145 | - (SDStateImageURLDictionary *)imageURLStorage { 146 | SDStateImageURLDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey); 147 | if (!storage) { 148 | storage = [NSMutableDictionary dictionary]; 149 | objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 150 | } 151 | 152 | return storage; 153 | } 154 | 155 | @end 156 | 157 | #endif 158 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIView+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIView+WebCache.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | 16 | static char imageURLKey; 17 | 18 | #if SD_UIKIT 19 | static char TAG_ACTIVITY_INDICATOR; 20 | static char TAG_ACTIVITY_STYLE; 21 | #endif 22 | static char TAG_ACTIVITY_SHOW; 23 | 24 | @implementation UIView (WebCache) 25 | 26 | - (nullable NSURL *)sd_imageURL { 27 | return objc_getAssociatedObject(self, &imageURLKey); 28 | } 29 | 30 | - (void)sd_internalSetImageWithURL:(nullable NSURL *)url 31 | placeholderImage:(nullable UIImage *)placeholder 32 | options:(SDWebImageOptions)options 33 | operationKey:(nullable NSString *)operationKey 34 | setImageBlock:(nullable SDSetImageBlock)setImageBlock 35 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 36 | completed:(nullable SDExternalCompletionBlock)completedBlock { 37 | NSString *validOperationKey = operationKey ?: NSStringFromClass([self class]); 38 | [self sd_cancelImageLoadOperationWithKey:validOperationKey]; 39 | objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 40 | 41 | if (!(options & SDWebImageDelayPlaceholder)) { 42 | dispatch_main_async_safe(^{ 43 | [self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock]; 44 | }); 45 | } 46 | 47 | if (url) { 48 | // check if activityView is enabled or not 49 | if ([self sd_showActivityIndicatorView]) { 50 | [self sd_addActivityIndicator]; 51 | } 52 | 53 | __weak __typeof(self)wself = self; 54 | id operation = [SDWebImageManager.sharedManager loadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 55 | __strong __typeof (wself) sself = wself; 56 | [sself sd_removeActivityIndicator]; 57 | if (!sself) { 58 | return; 59 | } 60 | dispatch_main_async_safe(^{ 61 | if (!sself) { 62 | return; 63 | } 64 | if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) { 65 | completedBlock(image, error, cacheType, url); 66 | return; 67 | } else if (image) { 68 | [sself sd_setImage:image imageData:data basedOnClassOrViaCustomSetImageBlock:setImageBlock]; 69 | [sself sd_setNeedsLayout]; 70 | } else { 71 | if ((options & SDWebImageDelayPlaceholder)) { 72 | [sself sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock]; 73 | [sself sd_setNeedsLayout]; 74 | } 75 | } 76 | if (completedBlock && finished) { 77 | completedBlock(image, error, cacheType, url); 78 | } 79 | }); 80 | }]; 81 | [self sd_setImageLoadOperation:operation forKey:validOperationKey]; 82 | } else { 83 | dispatch_main_async_safe(^{ 84 | [self sd_removeActivityIndicator]; 85 | if (completedBlock) { 86 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 87 | completedBlock(nil, error, SDImageCacheTypeNone, url); 88 | } 89 | }); 90 | } 91 | } 92 | 93 | - (void)sd_cancelCurrentImageLoad { 94 | [self sd_cancelImageLoadOperationWithKey:NSStringFromClass([self class])]; 95 | } 96 | 97 | - (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock { 98 | if (setImageBlock) { 99 | setImageBlock(image, imageData); 100 | return; 101 | } 102 | 103 | #if SD_UIKIT || SD_MAC 104 | if ([self isKindOfClass:[UIImageView class]]) { 105 | UIImageView *imageView = (UIImageView *)self; 106 | imageView.image = image; 107 | } 108 | #endif 109 | 110 | #if SD_UIKIT 111 | if ([self isKindOfClass:[UIButton class]]) { 112 | UIButton *button = (UIButton *)self; 113 | [button setImage:image forState:UIControlStateNormal]; 114 | } 115 | #endif 116 | } 117 | 118 | - (void)sd_setNeedsLayout { 119 | #if SD_UIKIT 120 | [self setNeedsLayout]; 121 | #elif SD_MAC 122 | [self setNeedsLayout:YES]; 123 | #endif 124 | } 125 | 126 | #pragma mark - Activity indicator 127 | 128 | #pragma mark - 129 | #if SD_UIKIT 130 | - (UIActivityIndicatorView *)activityIndicator { 131 | return (UIActivityIndicatorView *)objc_getAssociatedObject(self, &TAG_ACTIVITY_INDICATOR); 132 | } 133 | 134 | - (void)setActivityIndicator:(UIActivityIndicatorView *)activityIndicator { 135 | objc_setAssociatedObject(self, &TAG_ACTIVITY_INDICATOR, activityIndicator, OBJC_ASSOCIATION_RETAIN); 136 | } 137 | #endif 138 | 139 | - (void)sd_setShowActivityIndicatorView:(BOOL)show { 140 | objc_setAssociatedObject(self, &TAG_ACTIVITY_SHOW, @(show), OBJC_ASSOCIATION_RETAIN); 141 | } 142 | 143 | - (BOOL)sd_showActivityIndicatorView { 144 | return [objc_getAssociatedObject(self, &TAG_ACTIVITY_SHOW) boolValue]; 145 | } 146 | 147 | #if SD_UIKIT 148 | - (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style{ 149 | objc_setAssociatedObject(self, &TAG_ACTIVITY_STYLE, [NSNumber numberWithInt:style], OBJC_ASSOCIATION_RETAIN); 150 | } 151 | 152 | - (int)sd_getIndicatorStyle{ 153 | return [objc_getAssociatedObject(self, &TAG_ACTIVITY_STYLE) intValue]; 154 | } 155 | #endif 156 | 157 | - (void)sd_addActivityIndicator { 158 | #if SD_UIKIT 159 | dispatch_main_async_safe(^{ 160 | if (!self.activityIndicator) { 161 | self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]]; 162 | self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; 163 | 164 | [self addSubview:self.activityIndicator]; 165 | 166 | [self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator 167 | attribute:NSLayoutAttributeCenterX 168 | relatedBy:NSLayoutRelationEqual 169 | toItem:self 170 | attribute:NSLayoutAttributeCenterX 171 | multiplier:1.0 172 | constant:0.0]]; 173 | [self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator 174 | attribute:NSLayoutAttributeCenterY 175 | relatedBy:NSLayoutRelationEqual 176 | toItem:self 177 | attribute:NSLayoutAttributeCenterY 178 | multiplier:1.0 179 | constant:0.0]]; 180 | } 181 | [self.activityIndicator startAnimating]; 182 | }); 183 | #endif 184 | } 185 | 186 | - (void)sd_removeActivityIndicator { 187 | #if SD_UIKIT 188 | dispatch_main_async_safe(^{ 189 | if (self.activityIndicator) { 190 | [self.activityIndicator removeFromSuperview]; 191 | self.activityIndicator = nil; 192 | } 193 | }); 194 | #endif 195 | } 196 | 197 | @end 198 | 199 | #endif 200 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView. 17 | * 18 | * Usage with a UITableViewCell sub-class: 19 | * 20 | * @code 21 | 22 | #import 23 | 24 | ... 25 | 26 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 27 | { 28 | static NSString *MyIdentifier = @"MyIdentifier"; 29 | 30 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 31 | 32 | if (cell == nil) { 33 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] 34 | autorelease]; 35 | } 36 | 37 | // Here we use the provided sd_setImageWithURL: method to load the web image 38 | // Ensure you use a placeholder image otherwise cells will be initialized with no image 39 | [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"] 40 | placeholderImage:[UIImage imageNamed:@"placeholder"]]; 41 | 42 | cell.textLabel.text = @"My Text"; 43 | return cell; 44 | } 45 | 46 | * @endcode 47 | */ 48 | @interface UIImageView (WebCache) 49 | 50 | /** 51 | * Set the imageView `image` with an `url`. 52 | * 53 | * The download is asynchronous and cached. 54 | * 55 | * @param url The url for the image. 56 | */ 57 | - (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; 58 | 59 | /** 60 | * Set the imageView `image` with an `url` and a placeholder. 61 | * 62 | * The download is asynchronous and cached. 63 | * 64 | * @param url The url for the image. 65 | * @param placeholder The image to be set initially, until the image request finishes. 66 | * @see sd_setImageWithURL:placeholderImage:options: 67 | */ 68 | - (void)sd_setImageWithURL:(nullable NSURL *)url 69 | placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; 70 | 71 | /** 72 | * Set the imageView `image` with an `url`, placeholder and custom options. 73 | * 74 | * The download is asynchronous and cached. 75 | * 76 | * @param url The url for the image. 77 | * @param placeholder The image to be set initially, until the image request finishes. 78 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 79 | */ 80 | - (void)sd_setImageWithURL:(nullable NSURL *)url 81 | placeholderImage:(nullable UIImage *)placeholder 82 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 83 | 84 | /** 85 | * Set the imageView `image` with an `url`. 86 | * 87 | * The download is asynchronous and cached. 88 | * 89 | * @param url The url for the image. 90 | * @param completedBlock A block called when operation has been completed. This block has no return value 91 | * and takes the requested UIImage as first parameter. In case of error the image parameter 92 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 93 | * indicating if the image was retrieved from the local cache or from the network. 94 | * The fourth parameter is the original image url. 95 | */ 96 | - (void)sd_setImageWithURL:(nullable NSURL *)url 97 | completed:(nullable SDExternalCompletionBlock)completedBlock; 98 | 99 | /** 100 | * Set the imageView `image` with an `url`, placeholder. 101 | * 102 | * The download is asynchronous and cached. 103 | * 104 | * @param url The url for the image. 105 | * @param placeholder The image to be set initially, until the image request finishes. 106 | * @param completedBlock A block called when operation has been completed. This block has no return value 107 | * and takes the requested UIImage as first parameter. In case of error the image parameter 108 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 109 | * indicating if the image was retrieved from the local cache or from the network. 110 | * The fourth parameter is the original image url. 111 | */ 112 | - (void)sd_setImageWithURL:(nullable NSURL *)url 113 | placeholderImage:(nullable UIImage *)placeholder 114 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 115 | 116 | /** 117 | * Set the imageView `image` with an `url`, placeholder and custom options. 118 | * 119 | * The download is asynchronous and cached. 120 | * 121 | * @param url The url for the image. 122 | * @param placeholder The image to be set initially, until the image request finishes. 123 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 124 | * @param completedBlock A block called when operation has been completed. This block has no return value 125 | * and takes the requested UIImage as first parameter. In case of error the image parameter 126 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 127 | * indicating if the image was retrieved from the local cache or from the network. 128 | * The fourth parameter is the original image url. 129 | */ 130 | - (void)sd_setImageWithURL:(nullable NSURL *)url 131 | placeholderImage:(nullable UIImage *)placeholder 132 | options:(SDWebImageOptions)options 133 | completed:(nullable SDExternalCompletionBlock)completedBlock; 134 | 135 | /** 136 | * Set the imageView `image` with an `url`, placeholder and custom options. 137 | * 138 | * The download is asynchronous and cached. 139 | * 140 | * @param url The url for the image. 141 | * @param placeholder The image to be set initially, until the image request finishes. 142 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 143 | * @param progressBlock A block called while image is downloading 144 | * @note the progress block is executed on a background queue 145 | * @param completedBlock A block called when operation has been completed. This block has no return value 146 | * and takes the requested UIImage as first parameter. In case of error the image parameter 147 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 148 | * indicating if the image was retrieved from the local cache or from the network. 149 | * The fourth parameter is the original image url. 150 | */ 151 | - (void)sd_setImageWithURL:(nullable NSURL *)url 152 | placeholderImage:(nullable UIImage *)placeholder 153 | options:(SDWebImageOptions)options 154 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 155 | completed:(nullable SDExternalCompletionBlock)completedBlock; 156 | 157 | /** 158 | * Set the imageView `image` with an `url` and optionally a placeholder image. 159 | * 160 | * The download is asynchronous and cached. 161 | * 162 | * @param url The url for the image. 163 | * @param placeholder The image to be set initially, until the image request finishes. 164 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 165 | * @param progressBlock A block called while image is downloading 166 | * @note the progress block is executed on a background queue 167 | * @param completedBlock A block called when operation has been completed. This block has no return value 168 | * and takes the requested UIImage as first parameter. In case of error the image parameter 169 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 170 | * indicating if the image was retrieved from the local cache or from the network. 171 | * The fourth parameter is the original image url. 172 | */ 173 | - (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url 174 | placeholderImage:(nullable UIImage *)placeholder 175 | options:(SDWebImageOptions)options 176 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 177 | completed:(nullable SDExternalCompletionBlock)completedBlock; 178 | 179 | #if SD_UIKIT 180 | 181 | #pragma mark - Animation of multiple images 182 | 183 | /** 184 | * Download an array of images and starts them in an animation loop 185 | * 186 | * @param arrayOfURLs An array of NSURL 187 | */ 188 | - (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs; 189 | 190 | - (void)sd_cancelCurrentAnimationImagesLoad; 191 | 192 | #endif 193 | 194 | @end 195 | 196 | #endif 197 | -------------------------------------------------------------------------------- /Pods/SDWebImage/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | 6 | [![Build Status](http://img.shields.io/travis/rs/SDWebImage/master.svg?style=flat)](https://travis-ci.org/rs/SDWebImage) 7 | [![Pod Version](http://img.shields.io/cocoapods/v/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/) 8 | [![Pod Platform](http://img.shields.io/cocoapods/p/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/) 9 | [![Pod License](http://img.shields.io/cocoapods/l/SDWebImage.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html) 10 | [![Dependency Status](https://www.versioneye.com/objective-c/sdwebimage/badge.svg?style=flat)](https://www.versioneye.com/objective-c/sdwebimage) 11 | [![Reference Status](https://www.versioneye.com/objective-c/sdwebimage/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/sdwebimage/references) 12 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/rs/SDWebImage) 13 | [![codecov](https://codecov.io/gh/rs/SDWebImage/branch/master/graph/badge.svg)](https://codecov.io/gh/rs/SDWebImage) 14 | 15 | This library provides an async image downloader with cache support. For convenience, we added categories for UI elements like `UIImageView`, `UIButton`, `MKAnnotationView`. 16 | 17 | ## Features 18 | 19 | - [x] Categories for `UIImageView`, `UIButton`, `MKAnnotationView` adding web image and cache management 20 | - [x] An asynchronous image downloader 21 | - [x] An asynchronous memory + disk image caching with automatic cache expiration handling 22 | - [x] A background image decompression 23 | - [x] A guarantee that the same URL won't be downloaded several times 24 | - [x] A guarantee that bogus URLs won't be retried again and again 25 | - [x] A guarantee that main thread will never be blocked 26 | - [x] Performances! 27 | - [x] Use GCD and ARC 28 | 29 | ## Supported Image Formats 30 | 31 | - Image formats supported by UIImage (JPEG, PNG, ...), including GIF 32 | - WebP format, including animated WebP (use the `WebP` subspec) 33 | 34 | ## Requirements 35 | 36 | - iOS 7.0 or later 37 | - tvOS 9.0 or later 38 | - watchOS 2.0 or later 39 | - OS X 10.8 or later 40 | - Xcode 7.3 or later 41 | 42 | #### Backwards compatibility 43 | 44 | - For iOS 5 and 6, use [any 3.x version up to 3.7.6](https://github.com/rs/SDWebImage/tree/3.7.6) 45 | - For iOS < 5.0, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat). 46 | 47 | ## Getting Started 48 | 49 | - Read this Readme doc 50 | - Read the [How to use section](https://github.com/rs/SDWebImage#how-to-use) 51 | - Read the [documentation @ CocoaDocs](http://cocoadocs.org/docsets/SDWebImage/) 52 | - Read [How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F) 53 | - Try the example by downloading the project from Github or even easier using CocoaPods try `pod try SDWebImage` 54 | - Get to the [installation steps](https://github.com/rs/SDWebImage#installation) 55 | - Read the [SDWebImage 4.0 Migration Guide](Docs/SDWebImage-4.0-Migration-guide.md) to get an idea of the changes from 3.x to 4.x 56 | 57 | ## Who Uses It 58 | - Find out [who uses SDWebImage](https://github.com/rs/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list. 59 | 60 | ## Communication 61 | 62 | - If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage). (Tag 'sdwebimage') 63 | - If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage). 64 | - If you **found a bug**, open an issue. 65 | - If you **have a feature request**, open an issue. 66 | - If you **want to contribute**, submit a pull request. 67 | 68 | ## How To Use 69 | 70 | ```objective-c 71 | Objective-C: 72 | 73 | #import 74 | ... 75 | [imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] 76 | placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; 77 | ``` 78 | 79 | ```swift 80 | Swift: 81 | 82 | import SDWebImage 83 | 84 | imageView.sd_setImage(with: URL(string: "http://www.domain.com/path/to/image.jpg"), placeholderImage: UIImage(named: "placeholder.png")) 85 | ``` 86 | 87 | - For details about how to use the library and clear examples, see [The detailed How to use](Docs/HowToUse.md) 88 | 89 | ## Animated Images (GIF) support 90 | 91 | - Starting with the 4.0 version, we rely on [FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) to take care of our animated images. 92 | - If you use cocoapods, add `pod 'SDWebImage/GIF'` to your podfile. 93 | - To use it, simply make sure you use `FLAnimatedImageView` instead of `UIImageView`. 94 | - **Note**: there is a backwards compatible feature, so if you are still trying to load a GIF into a `UIImageView`, it will only show the 1st frame as a static image. 95 | - **Important**: FLAnimatedImage only works on the iOS platform. For OS X, use `NSImageView` with `animates` set to `YES` to show the entire animated images and `NO` to only show the 1st frame. For all the other platforms (tvOS, watchOS) we will fallback to the backwards compatibility feature described above 96 | 97 | ## Common Problems 98 | 99 | ### Using dynamic image size with UITableViewCell 100 | 101 | UITableView determines the size of the image by the first image set for a cell. If your remote images 102 | don't have the same size as your placeholder image, you may experience strange anamorphic scaling issue. 103 | The following article gives a way to workaround this issue: 104 | 105 | [http://www.wrichards.com/blog/2011/11/sdwebimage-fixed-width-cell-images/](http://www.wrichards.com/blog/2011/11/sdwebimage-fixed-width-cell-images/) 106 | 107 | 108 | ### Handle image refresh 109 | 110 | SDWebImage does very aggressive caching by default. It ignores all kind of caching control header returned by the HTTP server and cache the returned images with no time restriction. It implies your images URLs are static URLs pointing to images that never change. If the pointed image happen to change, some parts of the URL should change accordingly. 111 | 112 | If you don't control the image server you're using, you may not be able to change the URL when its content is updated. This is the case for Facebook avatar URLs for instance. In such case, you may use the `SDWebImageRefreshCached` flag. This will slightly degrade the performance but will respect the HTTP caching control headers: 113 | 114 | ``` objective-c 115 | [imageView sd_setImageWithURL:[NSURL URLWithString:@"https://graph.facebook.com/olivier.poitrey/picture"] 116 | placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"] 117 | options:SDWebImageRefreshCached]; 118 | ``` 119 | 120 | ### Add a progress indicator 121 | 122 | Add these before you call ```sd_setImageWithURL``` 123 | 124 | ``` objective-c 125 | [imageView sd_setShowActivityIndicatorView:YES]; 126 | [imageView sd_setIndicatorStyle:UIActivityIndicatorViewStyleGray]; 127 | ``` 128 | 129 | ``` swift 130 | imageView.sd_setShowActivityIndicatorView(true) 131 | imageView.sd_setIndicatorStyle(.Gray) 132 | ``` 133 | 134 | ## Installation 135 | 136 | There are three ways to use SDWebImage in your project: 137 | - using CocoaPods 138 | - using Carthage 139 | - by cloning the project into your repository 140 | 141 | ### Installation with CocoaPods 142 | 143 | [CocoaPods](http://cocoapods.org/) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the [Get Started](http://cocoapods.org/#get_started) section for more details. 144 | 145 | #### Podfile 146 | ``` 147 | platform :ios, '7.0' 148 | pod 'SDWebImage', '~> 4.0' 149 | ``` 150 | 151 | If you are using Swift, be sure to add `use_frameworks!` and set your target to iOS 8+: 152 | ``` 153 | platform :ios, '8.0' 154 | use_frameworks! 155 | ``` 156 | 157 | #### Subspecs 158 | 159 | There are 4 subspecs available now: `Core`, `MapKit`, `GIF` and `WebP` (this means you can install only some of the SDWebImage modules. By default, you get just `Core`, so if you need `WebP`, you need to specify it). 160 | 161 | Podfile example: 162 | ``` 163 | pod 'SDWebImage/WebP' 164 | ``` 165 | 166 | ### Installation with Carthage (iOS 8+) 167 | 168 | [Carthage](https://github.com/Carthage/Carthage) is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. 169 | 170 | To install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage) 171 | 172 | #### Cartfile 173 | ``` 174 | github "rs/SDWebImage" 175 | ``` 176 | 177 | ### Installation by cloning the repository 178 | - see [Manual install](Docs/ManualInstallation.md) 179 | 180 | ### Import headers in your source files 181 | 182 | In the source files where you need to use the library, import the header file: 183 | 184 | ```objective-c 185 | #import 186 | ``` 187 | 188 | ### Build Project 189 | 190 | At this point your workspace should build without error. If you are having problem, post to the Issue and the 191 | community can help you solve it. 192 | 193 | ## Author 194 | - [Olivier Poitrey](https://github.com/rs) 195 | 196 | ## Collaborators 197 | - [Konstantinos K.](https://github.com/mythodeia) 198 | - [Bogdan Poplauschi](https://github.com/bpoplauschi) 199 | - [Chester Liu](https://github.com/skyline75489) 200 | 201 | ## Licenses 202 | 203 | All source code is licensed under the [MIT License](https://raw.github.com/rs/SDWebImage/master/LICENSE). 204 | 205 | ## Architecture 206 | 207 |

208 | 209 |

210 | 211 |

212 | 213 |

214 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | #import "SDImageCacheConfig.h" 12 | 13 | typedef NS_ENUM(NSInteger, SDImageCacheType) { 14 | /** 15 | * The image wasn't available the SDWebImage caches, but was downloaded from the web. 16 | */ 17 | SDImageCacheTypeNone, 18 | /** 19 | * The image was obtained from the disk cache. 20 | */ 21 | SDImageCacheTypeDisk, 22 | /** 23 | * The image was obtained from the memory cache. 24 | */ 25 | SDImageCacheTypeMemory 26 | }; 27 | 28 | typedef void(^SDCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); 29 | 30 | typedef void(^SDWebImageCheckCacheCompletionBlock)(BOOL isInCache); 31 | 32 | typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger totalSize); 33 | 34 | 35 | /** 36 | * SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed 37 | * asynchronous so it doesn’t add unnecessary latency to the UI. 38 | */ 39 | @interface SDImageCache : NSObject 40 | 41 | #pragma mark - Properties 42 | 43 | /** 44 | * Cache Config object - storing all kind of settings 45 | */ 46 | @property (nonatomic, nonnull, readonly) SDImageCacheConfig *config; 47 | 48 | /** 49 | * The maximum "total cost" of the in-memory image cache. The cost function is the number of pixels held in memory. 50 | */ 51 | @property (assign, nonatomic) NSUInteger maxMemoryCost; 52 | 53 | /** 54 | * The maximum number of objects the cache should hold. 55 | */ 56 | @property (assign, nonatomic) NSUInteger maxMemoryCountLimit; 57 | 58 | #pragma mark - Singleton and initialization 59 | 60 | /** 61 | * Returns global shared cache instance 62 | * 63 | * @return SDImageCache global instance 64 | */ 65 | + (nonnull instancetype)sharedImageCache; 66 | 67 | /** 68 | * Init a new cache store with a specific namespace 69 | * 70 | * @param ns The namespace to use for this cache store 71 | */ 72 | - (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns; 73 | 74 | /** 75 | * Init a new cache store with a specific namespace and directory 76 | * 77 | * @param ns The namespace to use for this cache store 78 | * @param directory Directory to cache disk images in 79 | */ 80 | - (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns 81 | diskCacheDirectory:(nonnull NSString *)directory NS_DESIGNATED_INITIALIZER; 82 | 83 | #pragma mark - Cache paths 84 | 85 | - (nullable NSString *)makeDiskCachePath:(nonnull NSString*)fullNamespace; 86 | 87 | /** 88 | * Add a read-only cache path to search for images pre-cached by SDImageCache 89 | * Useful if you want to bundle pre-loaded images with your app 90 | * 91 | * @param path The path to use for this read-only cache path 92 | */ 93 | - (void)addReadOnlyCachePath:(nonnull NSString *)path; 94 | 95 | #pragma mark - Store Ops 96 | 97 | /** 98 | * Asynchronously store an image into memory and disk cache at the given key. 99 | * 100 | * @param image The image to store 101 | * @param key The unique image cache key, usually it's image absolute URL 102 | * @param completionBlock A block executed after the operation is finished 103 | */ 104 | - (void)storeImage:(nullable UIImage *)image 105 | forKey:(nullable NSString *)key 106 | completion:(nullable SDWebImageNoParamsBlock)completionBlock; 107 | 108 | /** 109 | * Asynchronously store an image into memory and disk cache at the given key. 110 | * 111 | * @param image The image to store 112 | * @param key The unique image cache key, usually it's image absolute URL 113 | * @param toDisk Store the image to disk cache if YES 114 | * @param completionBlock A block executed after the operation is finished 115 | */ 116 | - (void)storeImage:(nullable UIImage *)image 117 | forKey:(nullable NSString *)key 118 | toDisk:(BOOL)toDisk 119 | completion:(nullable SDWebImageNoParamsBlock)completionBlock; 120 | 121 | /** 122 | * Asynchronously store an image into memory and disk cache at the given key. 123 | * 124 | * @param image The image to store 125 | * @param imageData The image data as returned by the server, this representation will be used for disk storage 126 | * instead of converting the given image object into a storable/compressed image format in order 127 | * to save quality and CPU 128 | * @param key The unique image cache key, usually it's image absolute URL 129 | * @param toDisk Store the image to disk cache if YES 130 | * @param completionBlock A block executed after the operation is finished 131 | */ 132 | - (void)storeImage:(nullable UIImage *)image 133 | imageData:(nullable NSData *)imageData 134 | forKey:(nullable NSString *)key 135 | toDisk:(BOOL)toDisk 136 | completion:(nullable SDWebImageNoParamsBlock)completionBlock; 137 | 138 | /** 139 | * Synchronously store image NSData into disk cache at the given key. 140 | * 141 | * @warning This method is synchronous, make sure to call it from the ioQueue 142 | * 143 | * @param imageData The image data to store 144 | * @param key The unique image cache key, usually it's image absolute URL 145 | */ 146 | - (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key; 147 | 148 | #pragma mark - Query and Retrieve Ops 149 | 150 | /** 151 | * Async check if image exists in disk cache already (does not load the image) 152 | * 153 | * @param key the key describing the url 154 | * @param completionBlock the block to be executed when the check is done. 155 | * @note the completion block will be always executed on the main queue 156 | */ 157 | - (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; 158 | 159 | /** 160 | * Operation that queries the cache asynchronously and call the completion when done. 161 | * 162 | * @param key The unique key used to store the wanted image 163 | * @param doneBlock The completion block. Will not get called if the operation is cancelled 164 | * 165 | * @return a NSOperation instance containing the cache op 166 | */ 167 | - (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDCacheQueryCompletedBlock)doneBlock; 168 | 169 | /** 170 | * Query the memory cache synchronously. 171 | * 172 | * @param key The unique key used to store the image 173 | */ 174 | - (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key; 175 | 176 | /** 177 | * Query the disk cache synchronously. 178 | * 179 | * @param key The unique key used to store the image 180 | */ 181 | - (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key; 182 | 183 | /** 184 | * Query the cache (memory and or disk) synchronously after checking the memory cache. 185 | * 186 | * @param key The unique key used to store the image 187 | */ 188 | - (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key; 189 | 190 | #pragma mark - Remove Ops 191 | 192 | /** 193 | * Remove the image from memory and disk cache asynchronously 194 | * 195 | * @param key The unique image cache key 196 | * @param completion A block that should be executed after the image has been removed (optional) 197 | */ 198 | - (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion; 199 | 200 | /** 201 | * Remove the image from memory and optionally disk cache asynchronously 202 | * 203 | * @param key The unique image cache key 204 | * @param fromDisk Also remove cache entry from disk if YES 205 | * @param completion A block that should be executed after the image has been removed (optional) 206 | */ 207 | - (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion; 208 | 209 | #pragma mark - Cache clean Ops 210 | 211 | /** 212 | * Clear all memory cached images 213 | */ 214 | - (void)clearMemory; 215 | 216 | /** 217 | * Async clear all disk cached images. Non-blocking method - returns immediately. 218 | * @param completion A block that should be executed after cache expiration completes (optional) 219 | */ 220 | - (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion; 221 | 222 | /** 223 | * Async remove all expired cached image from disk. Non-blocking method - returns immediately. 224 | * @param completionBlock A block that should be executed after cache expiration completes (optional) 225 | */ 226 | - (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock; 227 | 228 | #pragma mark - Cache Info 229 | 230 | /** 231 | * Get the size used by the disk cache 232 | */ 233 | - (NSUInteger)getSize; 234 | 235 | /** 236 | * Get the number of images in the disk cache 237 | */ 238 | - (NSUInteger)getDiskCount; 239 | 240 | /** 241 | * Asynchronously calculate the disk cache's size. 242 | */ 243 | - (void)calculateSizeWithCompletionBlock:(nullable SDWebImageCalculateSizeBlock)completionBlock; 244 | 245 | #pragma mark - Cache Paths 246 | 247 | /** 248 | * Get the cache path for a certain key (needs the cache path root folder) 249 | * 250 | * @param key the key (can be obtained from url using cacheKeyForURL) 251 | * @param path the cache path root folder 252 | * 253 | * @return the cache path 254 | */ 255 | - (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path; 256 | 257 | /** 258 | * Get the default cache path for a certain key 259 | * 260 | * @param key the key (can be obtained from url using cacheKeyForURL) 261 | * 262 | * @return the default cache path 263 | */ 264 | - (nullable NSString *)defaultCachePathForKey:(nullable NSString *)key; 265 | 266 | @end 267 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) { 14 | SDWebImageDownloaderLowPriority = 1 << 0, 15 | SDWebImageDownloaderProgressiveDownload = 1 << 1, 16 | 17 | /** 18 | * By default, request prevent the use of NSURLCache. With this flag, NSURLCache 19 | * is used with default policies. 20 | */ 21 | SDWebImageDownloaderUseNSURLCache = 1 << 2, 22 | 23 | /** 24 | * Call completion block with nil image/imageData if the image was read from NSURLCache 25 | * (to be combined with `SDWebImageDownloaderUseNSURLCache`). 26 | * I think this option should be renamed to 'SDWebImageDownloaderUsingCachedResponseDontLoad' 27 | */ 28 | SDWebImageDownloaderIgnoreCachedResponse = 1 << 3, 29 | 30 | /** 31 | * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for 32 | * extra time in background to let the request finish. If the background task expires the operation will be cancelled. 33 | */ 34 | SDWebImageDownloaderContinueInBackground = 1 << 4, 35 | 36 | /** 37 | * Handles cookies stored in NSHTTPCookieStore by setting 38 | * NSMutableURLRequest.HTTPShouldHandleCookies = YES; 39 | */ 40 | SDWebImageDownloaderHandleCookies = 1 << 5, 41 | 42 | /** 43 | * Enable to allow untrusted SSL certificates. 44 | * Useful for testing purposes. Use with caution in production. 45 | */ 46 | SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6, 47 | 48 | /** 49 | * Put the image in the high priority queue. 50 | */ 51 | SDWebImageDownloaderHighPriority = 1 << 7, 52 | 53 | /** 54 | * Scale down the image 55 | */ 56 | SDWebImageDownloaderScaleDownLargeImages = 1 << 8, 57 | }; 58 | 59 | typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { 60 | /** 61 | * Default value. All download operations will execute in queue style (first-in-first-out). 62 | */ 63 | SDWebImageDownloaderFIFOExecutionOrder, 64 | 65 | /** 66 | * All download operations will execute in stack style (last-in-first-out). 67 | */ 68 | SDWebImageDownloaderLIFOExecutionOrder 69 | }; 70 | 71 | extern NSString * _Nonnull const SDWebImageDownloadStartNotification; 72 | extern NSString * _Nonnull const SDWebImageDownloadStopNotification; 73 | 74 | typedef void(^SDWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL); 75 | 76 | typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished); 77 | 78 | typedef NSDictionary SDHTTPHeadersDictionary; 79 | typedef NSMutableDictionary SDHTTPHeadersMutableDictionary; 80 | 81 | typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterBlock)(NSURL * _Nullable url, SDHTTPHeadersDictionary * _Nullable headers); 82 | 83 | /** 84 | * A token associated with each download. Can be used to cancel a download 85 | */ 86 | @interface SDWebImageDownloadToken : NSObject 87 | 88 | @property (nonatomic, strong, nullable) NSURL *url; 89 | @property (nonatomic, strong, nullable) id downloadOperationCancelToken; 90 | 91 | @end 92 | 93 | 94 | /** 95 | * Asynchronous downloader dedicated and optimized for image loading. 96 | */ 97 | @interface SDWebImageDownloader : NSObject 98 | 99 | /** 100 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 101 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 102 | */ 103 | @property (assign, nonatomic) BOOL shouldDecompressImages; 104 | 105 | /** 106 | * The maximum number of concurrent downloads 107 | */ 108 | @property (assign, nonatomic) NSInteger maxConcurrentDownloads; 109 | 110 | /** 111 | * Shows the current amount of downloads that still need to be downloaded 112 | */ 113 | @property (readonly, nonatomic) NSUInteger currentDownloadCount; 114 | 115 | 116 | /** 117 | * The timeout value (in seconds) for the download operation. Default: 15.0. 118 | */ 119 | @property (assign, nonatomic) NSTimeInterval downloadTimeout; 120 | 121 | 122 | /** 123 | * The configuration in use by the internal NSURLSession. 124 | * Mutating this object directly has no effect. 125 | * 126 | * @see createNewSessionWithConfiguration: 127 | */ 128 | @property (readonly, nonatomic, nonnull) NSURLSessionConfiguration *sessionConfiguration; 129 | 130 | 131 | /** 132 | * Changes download operations execution order. Default value is `SDWebImageDownloaderFIFOExecutionOrder`. 133 | */ 134 | @property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder; 135 | 136 | /** 137 | * Singleton method, returns the shared instance 138 | * 139 | * @return global shared instance of downloader class 140 | */ 141 | + (nonnull instancetype)sharedDownloader; 142 | 143 | /** 144 | * Set the default URL credential to be set for request operations. 145 | */ 146 | @property (strong, nonatomic, nullable) NSURLCredential *urlCredential; 147 | 148 | /** 149 | * Set username 150 | */ 151 | @property (strong, nonatomic, nullable) NSString *username; 152 | 153 | /** 154 | * Set password 155 | */ 156 | @property (strong, nonatomic, nullable) NSString *password; 157 | 158 | /** 159 | * Set filter to pick headers for downloading image HTTP request. 160 | * 161 | * This block will be invoked for each downloading image request, returned 162 | * NSDictionary will be used as headers in corresponding HTTP request. 163 | */ 164 | @property (nonatomic, copy, nullable) SDWebImageDownloaderHeadersFilterBlock headersFilter; 165 | 166 | /** 167 | * Creates an instance of a downloader with specified session configuration. 168 | * *Note*: `timeoutIntervalForRequest` is going to be overwritten. 169 | * @return new instance of downloader class 170 | */ 171 | - (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration NS_DESIGNATED_INITIALIZER; 172 | 173 | /** 174 | * Set a value for a HTTP header to be appended to each download HTTP request. 175 | * 176 | * @param value The value for the header field. Use `nil` value to remove the header. 177 | * @param field The name of the header field to set. 178 | */ 179 | - (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field; 180 | 181 | /** 182 | * Returns the value of the specified HTTP header field. 183 | * 184 | * @return The value associated with the header field field, or `nil` if there is no corresponding header field. 185 | */ 186 | - (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field; 187 | 188 | /** 189 | * Sets a subclass of `SDWebImageDownloaderOperation` as the default 190 | * `NSOperation` to be used each time SDWebImage constructs a request 191 | * operation to download an image. 192 | * 193 | * @param operationClass The subclass of `SDWebImageDownloaderOperation` to set 194 | * as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. 195 | */ 196 | - (void)setOperationClass:(nullable Class)operationClass; 197 | 198 | /** 199 | * Creates a SDWebImageDownloader async downloader instance with a given URL 200 | * 201 | * The delegate will be informed when the image is finish downloaded or an error has happen. 202 | * 203 | * @see SDWebImageDownloaderDelegate 204 | * 205 | * @param url The URL to the image to download 206 | * @param options The options to be used for this download 207 | * @param progressBlock A block called repeatedly while the image is downloading 208 | * @note the progress block is executed on a background queue 209 | * @param completedBlock A block called once the download is completed. 210 | * If the download succeeded, the image parameter is set, in case of error, 211 | * error parameter is set with the error. The last parameter is always YES 212 | * if SDWebImageDownloaderProgressiveDownload isn't use. With the 213 | * SDWebImageDownloaderProgressiveDownload option, this block is called 214 | * repeatedly with the partial image object and the finished argument set to NO 215 | * before to be called a last time with the full image and finished argument 216 | * set to YES. In case of error, the finished argument is always YES. 217 | * 218 | * @return A token (SDWebImageDownloadToken) that can be passed to -cancel: to cancel this operation 219 | */ 220 | - (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url 221 | options:(SDWebImageDownloaderOptions)options 222 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 223 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 224 | 225 | /** 226 | * Cancels a download that was previously queued using -downloadImageWithURL:options:progress:completed: 227 | * 228 | * @param token The token received from -downloadImageWithURL:options:progress:completed: that should be canceled. 229 | */ 230 | - (void)cancel:(nullable SDWebImageDownloadToken *)token; 231 | 232 | /** 233 | * Sets the download queue suspension state 234 | */ 235 | - (void)setSuspended:(BOOL)suspended; 236 | 237 | /** 238 | * Cancels all download operations in the queue 239 | */ 240 | - (void)cancelAllDownloads; 241 | 242 | /** 243 | * Forces SDWebImageDownloader to create and use a new NSURLSession that is 244 | * initialized with the given configuration. 245 | * *Note*: All existing download operations in the queue will be cancelled. 246 | * *Note*: `timeoutIntervalForRequest` is going to be overwritten. 247 | * 248 | * @param sessionConfiguration The configuration to use for the new NSURLSession 249 | */ 250 | - (void)createNewSessionWithConfiguration:(nonnull NSURLSessionConfiguration *)sessionConfiguration; 251 | 252 | @end 253 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "SDWebImageOperation.h" 11 | #import "SDWebImageDownloader.h" 12 | #import "SDImageCache.h" 13 | 14 | typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { 15 | /** 16 | * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. 17 | * This flag disable this blacklisting. 18 | */ 19 | SDWebImageRetryFailed = 1 << 0, 20 | 21 | /** 22 | * By default, image downloads are started during UI interactions, this flags disable this feature, 23 | * leading to delayed download on UIScrollView deceleration for instance. 24 | */ 25 | SDWebImageLowPriority = 1 << 1, 26 | 27 | /** 28 | * This flag disables on-disk caching 29 | */ 30 | SDWebImageCacheMemoryOnly = 1 << 2, 31 | 32 | /** 33 | * This flag enables progressive download, the image is displayed progressively during download as a browser would do. 34 | * By default, the image is only displayed once completely downloaded. 35 | */ 36 | SDWebImageProgressiveDownload = 1 << 3, 37 | 38 | /** 39 | * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed. 40 | * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation. 41 | * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics. 42 | * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image. 43 | * 44 | * Use this flag only if you can't make your URLs static with embedded cache busting parameter. 45 | */ 46 | SDWebImageRefreshCached = 1 << 4, 47 | 48 | /** 49 | * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for 50 | * extra time in background to let the request finish. If the background task expires the operation will be cancelled. 51 | */ 52 | SDWebImageContinueInBackground = 1 << 5, 53 | 54 | /** 55 | * Handles cookies stored in NSHTTPCookieStore by setting 56 | * NSMutableURLRequest.HTTPShouldHandleCookies = YES; 57 | */ 58 | SDWebImageHandleCookies = 1 << 6, 59 | 60 | /** 61 | * Enable to allow untrusted SSL certificates. 62 | * Useful for testing purposes. Use with caution in production. 63 | */ 64 | SDWebImageAllowInvalidSSLCertificates = 1 << 7, 65 | 66 | /** 67 | * By default, images are loaded in the order in which they were queued. This flag moves them to 68 | * the front of the queue. 69 | */ 70 | SDWebImageHighPriority = 1 << 8, 71 | 72 | /** 73 | * By default, placeholder images are loaded while the image is loading. This flag will delay the loading 74 | * of the placeholder image until after the image has finished loading. 75 | */ 76 | SDWebImageDelayPlaceholder = 1 << 9, 77 | 78 | /** 79 | * We usually don't call transformDownloadedImage delegate method on animated images, 80 | * as most transformation code would mangle it. 81 | * Use this flag to transform them anyway. 82 | */ 83 | SDWebImageTransformAnimatedImage = 1 << 10, 84 | 85 | /** 86 | * By default, image is added to the imageView after download. But in some cases, we want to 87 | * have the hand before setting the image (apply a filter or add it with cross-fade animation for instance) 88 | * Use this flag if you want to manually set the image in the completion when success 89 | */ 90 | SDWebImageAvoidAutoSetImage = 1 << 11, 91 | 92 | /** 93 | * By default, images are decoded respecting their original size. On iOS, this flag will scale down the 94 | * images to a size compatible with the constrained memory of devices. 95 | * If `SDWebImageProgressiveDownload` flag is set the scale down is deactivated. 96 | */ 97 | SDWebImageScaleDownLargeImages = 1 << 12 98 | }; 99 | 100 | typedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL); 101 | 102 | typedef void(^SDInternalCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL); 103 | 104 | typedef NSString * _Nullable (^SDWebImageCacheKeyFilterBlock)(NSURL * _Nullable url); 105 | 106 | 107 | @class SDWebImageManager; 108 | 109 | @protocol SDWebImageManagerDelegate 110 | 111 | @optional 112 | 113 | /** 114 | * Controls which image should be downloaded when the image is not found in the cache. 115 | * 116 | * @param imageManager The current `SDWebImageManager` 117 | * @param imageURL The url of the image to be downloaded 118 | * 119 | * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied. 120 | */ 121 | - (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldDownloadImageForURL:(nullable NSURL *)imageURL; 122 | 123 | /** 124 | * Allows to transform the image immediately after it has been downloaded and just before to cache it on disk and memory. 125 | * NOTE: This method is called from a global queue in order to not to block the main thread. 126 | * 127 | * @param imageManager The current `SDWebImageManager` 128 | * @param image The image to transform 129 | * @param imageURL The url of the image to transform 130 | * 131 | * @return The transformed image object. 132 | */ 133 | - (nullable UIImage *)imageManager:(nonnull SDWebImageManager *)imageManager transformDownloadedImage:(nullable UIImage *)image withURL:(nullable NSURL *)imageURL; 134 | 135 | @end 136 | 137 | /** 138 | * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes. 139 | * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache). 140 | * You can use this class directly to benefit from web image downloading with caching in another context than 141 | * a UIView. 142 | * 143 | * Here is a simple example of how to use SDWebImageManager: 144 | * 145 | * @code 146 | 147 | SDWebImageManager *manager = [SDWebImageManager sharedManager]; 148 | [manager loadImageWithURL:imageURL 149 | options:0 150 | progress:nil 151 | completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 152 | if (image) { 153 | // do something with image 154 | } 155 | }]; 156 | 157 | * @endcode 158 | */ 159 | @interface SDWebImageManager : NSObject 160 | 161 | @property (weak, nonatomic, nullable) id delegate; 162 | 163 | @property (strong, nonatomic, readonly, nullable) SDImageCache *imageCache; 164 | @property (strong, nonatomic, readonly, nullable) SDWebImageDownloader *imageDownloader; 165 | 166 | /** 167 | * The cache filter is a block used each time SDWebImageManager need to convert an URL into a cache key. This can 168 | * be used to remove dynamic part of an image URL. 169 | * 170 | * The following example sets a filter in the application delegate that will remove any query-string from the 171 | * URL before to use it as a cache key: 172 | * 173 | * @code 174 | 175 | [[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) { 176 | url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; 177 | return [url absoluteString]; 178 | }]; 179 | 180 | * @endcode 181 | */ 182 | @property (nonatomic, copy, nullable) SDWebImageCacheKeyFilterBlock cacheKeyFilter; 183 | 184 | /** 185 | * Returns global SDWebImageManager instance. 186 | * 187 | * @return SDWebImageManager shared instance 188 | */ 189 | + (nonnull instancetype)sharedManager; 190 | 191 | /** 192 | * Allows to specify instance of cache and image downloader used with image manager. 193 | * @return new instance of `SDWebImageManager` with specified cache and downloader. 194 | */ 195 | - (nonnull instancetype)initWithCache:(nonnull SDImageCache *)cache downloader:(nonnull SDWebImageDownloader *)downloader NS_DESIGNATED_INITIALIZER; 196 | 197 | /** 198 | * Downloads the image at the given URL if not present in cache or return the cached version otherwise. 199 | * 200 | * @param url The URL to the image 201 | * @param options A mask to specify options to use for this request 202 | * @param progressBlock A block called while image is downloading 203 | * @note the progress block is executed on a background queue 204 | * @param completedBlock A block called when operation has been completed. 205 | * 206 | * This parameter is required. 207 | * 208 | * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. 209 | * In case of error the image parameter is nil and the third parameter may contain an NSError. 210 | * 211 | * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache 212 | * or from the memory cache or from the network. 213 | * 214 | * The fith parameter is set to NO when the SDWebImageProgressiveDownload option is used and the image is 215 | * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the 216 | * block is called a last time with the full image and the last parameter set to YES. 217 | * 218 | * The last parameter is the original image URL 219 | * 220 | * @return Returns an NSObject conforming to SDWebImageOperation. Should be an instance of SDWebImageDownloaderOperation 221 | */ 222 | - (nullable id )loadImageWithURL:(nullable NSURL *)url 223 | options:(SDWebImageOptions)options 224 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 225 | completed:(nullable SDInternalCompletionBlock)completedBlock; 226 | 227 | /** 228 | * Saves image to cache for given URL 229 | * 230 | * @param image The image to cache 231 | * @param url The URL to the image 232 | * 233 | */ 234 | 235 | - (void)saveImageToCache:(nullable UIImage *)image forURL:(nullable NSURL *)url; 236 | 237 | /** 238 | * Cancel all current operations 239 | */ 240 | - (void)cancelAll; 241 | 242 | /** 243 | * Check one or more operations running 244 | */ 245 | - (BOOL)isRunning; 246 | 247 | /** 248 | * Async check if image has already been cached 249 | * 250 | * @param url image url 251 | * @param completionBlock the block to be executed when the check is finished 252 | * 253 | * @note the completion block is always executed on the main queue 254 | */ 255 | - (void)cachedImageExistsForURL:(nullable NSURL *)url 256 | completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; 257 | 258 | /** 259 | * Async check if image has already been cached on disk only 260 | * 261 | * @param url image url 262 | * @param completionBlock the block to be executed when the check is finished 263 | * 264 | * @note the completion block is always executed on the main queue 265 | */ 266 | - (void)diskImageExistsForURL:(nullable NSURL *)url 267 | completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; 268 | 269 | 270 | /** 271 | *Return the cache key for a given URL 272 | */ 273 | - (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url; 274 | 275 | @end 276 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIButtonView. 17 | */ 18 | @interface UIButton (WebCache) 19 | 20 | /** 21 | * Get the current image URL. 22 | */ 23 | - (nullable NSURL *)sd_currentImageURL; 24 | 25 | #pragma mark - Image 26 | 27 | /** 28 | * Get the image URL for a control state. 29 | * 30 | * @param state Which state you want to know the URL for. The values are described in UIControlState. 31 | */ 32 | - (nullable NSURL *)sd_imageURLForState:(UIControlState)state; 33 | 34 | /** 35 | * Set the imageView `image` with an `url`. 36 | * 37 | * The download is asynchronous and cached. 38 | * 39 | * @param url The url for the image. 40 | * @param state The state that uses the specified title. The values are described in UIControlState. 41 | */ 42 | - (void)sd_setImageWithURL:(nullable NSURL *)url 43 | forState:(UIControlState)state NS_REFINED_FOR_SWIFT; 44 | 45 | /** 46 | * Set the imageView `image` with an `url` and a placeholder. 47 | * 48 | * The download is asynchronous and cached. 49 | * 50 | * @param url The url for the image. 51 | * @param state The state that uses the specified title. The values are described in UIControlState. 52 | * @param placeholder The image to be set initially, until the image request finishes. 53 | * @see sd_setImageWithURL:placeholderImage:options: 54 | */ 55 | - (void)sd_setImageWithURL:(nullable NSURL *)url 56 | forState:(UIControlState)state 57 | placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; 58 | 59 | /** 60 | * Set the imageView `image` with an `url`, placeholder and custom options. 61 | * 62 | * The download is asynchronous and cached. 63 | * 64 | * @param url The url for the image. 65 | * @param state The state that uses the specified title. The values are described in UIControlState. 66 | * @param placeholder The image to be set initially, until the image request finishes. 67 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 68 | */ 69 | - (void)sd_setImageWithURL:(nullable NSURL *)url 70 | forState:(UIControlState)state 71 | placeholderImage:(nullable UIImage *)placeholder 72 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 73 | 74 | /** 75 | * Set the imageView `image` with an `url`. 76 | * 77 | * The download is asynchronous and cached. 78 | * 79 | * @param url The url for the image. 80 | * @param state The state that uses the specified title. The values are described in UIControlState. 81 | * @param completedBlock A block called when operation has been completed. This block has no return value 82 | * and takes the requested UIImage as first parameter. In case of error the image parameter 83 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 84 | * indicating if the image was retrieved from the local cache or from the network. 85 | * The fourth parameter is the original image url. 86 | */ 87 | - (void)sd_setImageWithURL:(nullable NSURL *)url 88 | forState:(UIControlState)state 89 | completed:(nullable SDExternalCompletionBlock)completedBlock; 90 | 91 | /** 92 | * Set the imageView `image` with an `url`, placeholder. 93 | * 94 | * The download is asynchronous and cached. 95 | * 96 | * @param url The url for the image. 97 | * @param state The state that uses the specified title. The values are described in UIControlState. 98 | * @param placeholder The image to be set initially, until the image request finishes. 99 | * @param completedBlock A block called when operation has been completed. This block has no return value 100 | * and takes the requested UIImage as first parameter. In case of error the image parameter 101 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 102 | * indicating if the image was retrieved from the local cache or from the network. 103 | * The fourth parameter is the original image url. 104 | */ 105 | - (void)sd_setImageWithURL:(nullable NSURL *)url 106 | forState:(UIControlState)state 107 | placeholderImage:(nullable UIImage *)placeholder 108 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 109 | 110 | /** 111 | * Set the imageView `image` with an `url`, placeholder and custom options. 112 | * 113 | * The download is asynchronous and cached. 114 | * 115 | * @param url The url for the image. 116 | * @param state The state that uses the specified title. The values are described in UIControlState. 117 | * @param placeholder The image to be set initially, until the image request finishes. 118 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 119 | * @param completedBlock A block called when operation has been completed. This block has no return value 120 | * and takes the requested UIImage as first parameter. In case of error the image parameter 121 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 122 | * indicating if the image was retrieved from the local cache or from the network. 123 | * The fourth parameter is the original image url. 124 | */ 125 | - (void)sd_setImageWithURL:(nullable NSURL *)url 126 | forState:(UIControlState)state 127 | placeholderImage:(nullable UIImage *)placeholder 128 | options:(SDWebImageOptions)options 129 | completed:(nullable SDExternalCompletionBlock)completedBlock; 130 | 131 | #pragma mark - Background image 132 | 133 | /** 134 | * Set the backgroundImageView `image` with an `url`. 135 | * 136 | * The download is asynchronous and cached. 137 | * 138 | * @param url The url for the image. 139 | * @param state The state that uses the specified title. The values are described in UIControlState. 140 | */ 141 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 142 | forState:(UIControlState)state NS_REFINED_FOR_SWIFT; 143 | 144 | /** 145 | * Set the backgroundImageView `image` with an `url` and a placeholder. 146 | * 147 | * The download is asynchronous and cached. 148 | * 149 | * @param url The url for the image. 150 | * @param state The state that uses the specified title. The values are described in UIControlState. 151 | * @param placeholder The image to be set initially, until the image request finishes. 152 | * @see sd_setImageWithURL:placeholderImage:options: 153 | */ 154 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 155 | forState:(UIControlState)state 156 | placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; 157 | 158 | /** 159 | * Set the backgroundImageView `image` with an `url`, placeholder and custom options. 160 | * 161 | * The download is asynchronous and cached. 162 | * 163 | * @param url The url for the image. 164 | * @param state The state that uses the specified title. The values are described in UIControlState. 165 | * @param placeholder The image to be set initially, until the image request finishes. 166 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 167 | */ 168 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 169 | forState:(UIControlState)state 170 | placeholderImage:(nullable UIImage *)placeholder 171 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 172 | 173 | /** 174 | * Set the backgroundImageView `image` with an `url`. 175 | * 176 | * The download is asynchronous and cached. 177 | * 178 | * @param url The url for the image. 179 | * @param state The state that uses the specified title. The values are described in UIControlState. 180 | * @param completedBlock A block called when operation has been completed. This block has no return value 181 | * and takes the requested UIImage as first parameter. In case of error the image parameter 182 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 183 | * indicating if the image was retrieved from the local cache or from the network. 184 | * The fourth parameter is the original image url. 185 | */ 186 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 187 | forState:(UIControlState)state 188 | completed:(nullable SDExternalCompletionBlock)completedBlock; 189 | 190 | /** 191 | * Set the backgroundImageView `image` with an `url`, placeholder. 192 | * 193 | * The download is asynchronous and cached. 194 | * 195 | * @param url The url for the image. 196 | * @param state The state that uses the specified title. The values are described in UIControlState. 197 | * @param placeholder The image to be set initially, until the image request finishes. 198 | * @param completedBlock A block called when operation has been completed. This block has no return value 199 | * and takes the requested UIImage as first parameter. In case of error the image parameter 200 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 201 | * indicating if the image was retrieved from the local cache or from the network. 202 | * The fourth parameter is the original image url. 203 | */ 204 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 205 | forState:(UIControlState)state 206 | placeholderImage:(nullable UIImage *)placeholder 207 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 208 | 209 | /** 210 | * Set the backgroundImageView `image` with an `url`, placeholder and custom options. 211 | * 212 | * The download is asynchronous and cached. 213 | * 214 | * @param url The url for the image. 215 | * @param placeholder The image to be set initially, until the image request finishes. 216 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 217 | * @param completedBlock A block called when operation has been completed. This block has no return value 218 | * and takes the requested UIImage as first parameter. In case of error the image parameter 219 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 220 | * indicating if the image was retrieved from the local cache or from the network. 221 | * The fourth parameter is the original image url. 222 | */ 223 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 224 | forState:(UIControlState)state 225 | placeholderImage:(nullable UIImage *)placeholder 226 | options:(SDWebImageOptions)options 227 | completed:(nullable SDExternalCompletionBlock)completedBlock; 228 | 229 | #pragma mark - Cancel 230 | 231 | /** 232 | * Cancel the current image download 233 | */ 234 | - (void)sd_cancelImageLoadForState:(UIControlState)state; 235 | 236 | /** 237 | * Cancel the current backgroundImage download 238 | */ 239 | - (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state; 240 | 241 | @end 242 | 243 | #endif 244 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) james 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageDecoder.h" 11 | 12 | @implementation UIImage (ForceDecode) 13 | 14 | #if SD_UIKIT || SD_WATCH 15 | static const size_t kBytesPerPixel = 4; 16 | static const size_t kBitsPerComponent = 8; 17 | 18 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image { 19 | if (![UIImage shouldDecodeImage:image]) { 20 | return image; 21 | } 22 | 23 | // autorelease the bitmap context and all vars to help system to free memory when there are memory warning. 24 | // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory]; 25 | @autoreleasepool{ 26 | 27 | CGImageRef imageRef = image.CGImage; 28 | CGColorSpaceRef colorspaceRef = [UIImage colorSpaceForImageRef:imageRef]; 29 | 30 | size_t width = CGImageGetWidth(imageRef); 31 | size_t height = CGImageGetHeight(imageRef); 32 | size_t bytesPerRow = kBytesPerPixel * width; 33 | 34 | // kCGImageAlphaNone is not supported in CGBitmapContextCreate. 35 | // Since the original image here has no alpha info, use kCGImageAlphaNoneSkipLast 36 | // to create bitmap graphics contexts without alpha info. 37 | CGContextRef context = CGBitmapContextCreate(NULL, 38 | width, 39 | height, 40 | kBitsPerComponent, 41 | bytesPerRow, 42 | colorspaceRef, 43 | kCGBitmapByteOrderDefault|kCGImageAlphaNoneSkipLast); 44 | if (context == NULL) { 45 | return image; 46 | } 47 | 48 | // Draw the image into the context and retrieve the new bitmap image without alpha 49 | CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); 50 | CGImageRef imageRefWithoutAlpha = CGBitmapContextCreateImage(context); 51 | UIImage *imageWithoutAlpha = [UIImage imageWithCGImage:imageRefWithoutAlpha 52 | scale:image.scale 53 | orientation:image.imageOrientation]; 54 | 55 | CGContextRelease(context); 56 | CGImageRelease(imageRefWithoutAlpha); 57 | 58 | return imageWithoutAlpha; 59 | } 60 | } 61 | 62 | /* 63 | * Defines the maximum size in MB of the decoded image when the flag `SDWebImageScaleDownLargeImages` is set 64 | * Suggested value for iPad1 and iPhone 3GS: 60. 65 | * Suggested value for iPad2 and iPhone 4: 120. 66 | * Suggested value for iPhone 3G and iPod 2 and earlier devices: 30. 67 | */ 68 | static const CGFloat kDestImageSizeMB = 60.0f; 69 | 70 | /* 71 | * Defines the maximum size in MB of a tile used to decode image when the flag `SDWebImageScaleDownLargeImages` is set 72 | * Suggested value for iPad1 and iPhone 3GS: 20. 73 | * Suggested value for iPad2 and iPhone 4: 40. 74 | * Suggested value for iPhone 3G and iPod 2 and earlier devices: 10. 75 | */ 76 | static const CGFloat kSourceImageTileSizeMB = 20.0f; 77 | 78 | static const CGFloat kBytesPerMB = 1024.0f * 1024.0f; 79 | static const CGFloat kPixelsPerMB = kBytesPerMB / kBytesPerPixel; 80 | static const CGFloat kDestTotalPixels = kDestImageSizeMB * kPixelsPerMB; 81 | static const CGFloat kTileTotalPixels = kSourceImageTileSizeMB * kPixelsPerMB; 82 | 83 | static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to overlap the seems where tiles meet. 84 | 85 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image { 86 | if (![UIImage shouldDecodeImage:image]) { 87 | return image; 88 | } 89 | 90 | if (![UIImage shouldScaleDownImage:image]) { 91 | return [UIImage decodedImageWithImage:image]; 92 | } 93 | 94 | CGContextRef destContext; 95 | 96 | // autorelease the bitmap context and all vars to help system to free memory when there are memory warning. 97 | // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory]; 98 | @autoreleasepool { 99 | CGImageRef sourceImageRef = image.CGImage; 100 | 101 | CGSize sourceResolution = CGSizeZero; 102 | sourceResolution.width = CGImageGetWidth(sourceImageRef); 103 | sourceResolution.height = CGImageGetHeight(sourceImageRef); 104 | float sourceTotalPixels = sourceResolution.width * sourceResolution.height; 105 | // Determine the scale ratio to apply to the input image 106 | // that results in an output image of the defined size. 107 | // see kDestImageSizeMB, and how it relates to destTotalPixels. 108 | float imageScale = kDestTotalPixels / sourceTotalPixels; 109 | CGSize destResolution = CGSizeZero; 110 | destResolution.width = (int)(sourceResolution.width*imageScale); 111 | destResolution.height = (int)(sourceResolution.height*imageScale); 112 | 113 | // current color space 114 | CGColorSpaceRef colorspaceRef = [UIImage colorSpaceForImageRef:sourceImageRef]; 115 | 116 | size_t bytesPerRow = kBytesPerPixel * destResolution.width; 117 | 118 | // Allocate enough pixel data to hold the output image. 119 | void* destBitmapData = malloc( bytesPerRow * destResolution.height ); 120 | if (destBitmapData == NULL) { 121 | return image; 122 | } 123 | 124 | // kCGImageAlphaNone is not supported in CGBitmapContextCreate. 125 | // Since the original image here has no alpha info, use kCGImageAlphaNoneSkipLast 126 | // to create bitmap graphics contexts without alpha info. 127 | destContext = CGBitmapContextCreate(destBitmapData, 128 | destResolution.width, 129 | destResolution.height, 130 | kBitsPerComponent, 131 | bytesPerRow, 132 | colorspaceRef, 133 | kCGBitmapByteOrderDefault|kCGImageAlphaNoneSkipLast); 134 | 135 | if (destContext == NULL) { 136 | free(destBitmapData); 137 | return image; 138 | } 139 | CGContextSetInterpolationQuality(destContext, kCGInterpolationHigh); 140 | 141 | // Now define the size of the rectangle to be used for the 142 | // incremental blits from the input image to the output image. 143 | // we use a source tile width equal to the width of the source 144 | // image due to the way that iOS retrieves image data from disk. 145 | // iOS must decode an image from disk in full width 'bands', even 146 | // if current graphics context is clipped to a subrect within that 147 | // band. Therefore we fully utilize all of the pixel data that results 148 | // from a decoding opertion by achnoring our tile size to the full 149 | // width of the input image. 150 | CGRect sourceTile = CGRectZero; 151 | sourceTile.size.width = sourceResolution.width; 152 | // The source tile height is dynamic. Since we specified the size 153 | // of the source tile in MB, see how many rows of pixels high it 154 | // can be given the input image width. 155 | sourceTile.size.height = (int)(kTileTotalPixels / sourceTile.size.width ); 156 | sourceTile.origin.x = 0.0f; 157 | // The output tile is the same proportions as the input tile, but 158 | // scaled to image scale. 159 | CGRect destTile; 160 | destTile.size.width = destResolution.width; 161 | destTile.size.height = sourceTile.size.height * imageScale; 162 | destTile.origin.x = 0.0f; 163 | // The source seem overlap is proportionate to the destination seem overlap. 164 | // this is the amount of pixels to overlap each tile as we assemble the ouput image. 165 | float sourceSeemOverlap = (int)((kDestSeemOverlap/destResolution.height)*sourceResolution.height); 166 | CGImageRef sourceTileImageRef; 167 | // calculate the number of read/write operations required to assemble the 168 | // output image. 169 | int iterations = (int)( sourceResolution.height / sourceTile.size.height ); 170 | // If tile height doesn't divide the image height evenly, add another iteration 171 | // to account for the remaining pixels. 172 | int remainder = (int)sourceResolution.height % (int)sourceTile.size.height; 173 | if(remainder) { 174 | iterations++; 175 | } 176 | // Add seem overlaps to the tiles, but save the original tile height for y coordinate calculations. 177 | float sourceTileHeightMinusOverlap = sourceTile.size.height; 178 | sourceTile.size.height += sourceSeemOverlap; 179 | destTile.size.height += kDestSeemOverlap; 180 | for( int y = 0; y < iterations; ++y ) { 181 | @autoreleasepool { 182 | sourceTile.origin.y = y * sourceTileHeightMinusOverlap + sourceSeemOverlap; 183 | destTile.origin.y = destResolution.height - (( y + 1 ) * sourceTileHeightMinusOverlap * imageScale + kDestSeemOverlap); 184 | sourceTileImageRef = CGImageCreateWithImageInRect( sourceImageRef, sourceTile ); 185 | if( y == iterations - 1 && remainder ) { 186 | float dify = destTile.size.height; 187 | destTile.size.height = CGImageGetHeight( sourceTileImageRef ) * imageScale; 188 | dify -= destTile.size.height; 189 | destTile.origin.y += dify; 190 | } 191 | CGContextDrawImage( destContext, destTile, sourceTileImageRef ); 192 | CGImageRelease( sourceTileImageRef ); 193 | } 194 | } 195 | 196 | CGImageRef destImageRef = CGBitmapContextCreateImage(destContext); 197 | CGContextRelease(destContext); 198 | if (destImageRef == NULL) { 199 | return image; 200 | } 201 | UIImage *destImage = [UIImage imageWithCGImage:destImageRef scale:image.scale orientation:image.imageOrientation]; 202 | CGImageRelease(destImageRef); 203 | if (destImage == nil) { 204 | return image; 205 | } 206 | return destImage; 207 | } 208 | } 209 | 210 | + (BOOL)shouldDecodeImage:(nullable UIImage *)image { 211 | // Prevent "CGBitmapContextCreateImage: invalid context 0x0" error 212 | if (image == nil) { 213 | return NO; 214 | } 215 | 216 | // do not decode animated images 217 | if (image.images != nil) { 218 | return NO; 219 | } 220 | 221 | CGImageRef imageRef = image.CGImage; 222 | 223 | CGImageAlphaInfo alpha = CGImageGetAlphaInfo(imageRef); 224 | BOOL anyAlpha = (alpha == kCGImageAlphaFirst || 225 | alpha == kCGImageAlphaLast || 226 | alpha == kCGImageAlphaPremultipliedFirst || 227 | alpha == kCGImageAlphaPremultipliedLast); 228 | // do not decode images with alpha 229 | if (anyAlpha) { 230 | return NO; 231 | } 232 | 233 | return YES; 234 | } 235 | 236 | + (BOOL)shouldScaleDownImage:(nonnull UIImage *)image { 237 | BOOL shouldScaleDown = YES; 238 | 239 | CGImageRef sourceImageRef = image.CGImage; 240 | CGSize sourceResolution = CGSizeZero; 241 | sourceResolution.width = CGImageGetWidth(sourceImageRef); 242 | sourceResolution.height = CGImageGetHeight(sourceImageRef); 243 | float sourceTotalPixels = sourceResolution.width * sourceResolution.height; 244 | float imageScale = kDestTotalPixels / sourceTotalPixels; 245 | if (imageScale < 1) { 246 | shouldScaleDown = YES; 247 | } else { 248 | shouldScaleDown = NO; 249 | } 250 | 251 | return shouldScaleDown; 252 | } 253 | 254 | + (CGColorSpaceRef)colorSpaceForImageRef:(CGImageRef)imageRef { 255 | // current 256 | CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(CGImageGetColorSpace(imageRef)); 257 | CGColorSpaceRef colorspaceRef = CGImageGetColorSpace(imageRef); 258 | 259 | BOOL unsupportedColorSpace = (imageColorSpaceModel == kCGColorSpaceModelUnknown || 260 | imageColorSpaceModel == kCGColorSpaceModelMonochrome || 261 | imageColorSpaceModel == kCGColorSpaceModelCMYK || 262 | imageColorSpaceModel == kCGColorSpaceModelIndexed); 263 | if (unsupportedColorSpace) { 264 | colorspaceRef = CGColorSpaceCreateDeviceRGB(); 265 | CFAutorelease(colorspaceRef); 266 | } 267 | return colorspaceRef; 268 | } 269 | #elif SD_MAC 270 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image { 271 | return image; 272 | } 273 | 274 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image { 275 | return image; 276 | } 277 | #endif 278 | 279 | @end 280 | --------------------------------------------------------------------------------