├── .gitignore ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── JSONModel │ ├── JSONModel │ │ ├── JSONModel │ │ │ ├── JSONModel.h │ │ │ ├── JSONModel.m │ │ │ ├── JSONModelClassProperty.h │ │ │ ├── JSONModelClassProperty.m │ │ │ ├── JSONModelError.h │ │ │ └── JSONModelError.m │ │ ├── JSONModelLib.h │ │ ├── JSONModelNetworking │ │ │ ├── JSONAPI.h │ │ │ ├── JSONAPI.m │ │ │ ├── JSONHTTPClient.h │ │ │ ├── JSONHTTPClient.m │ │ │ ├── JSONModel+networking.h │ │ │ └── JSONModel+networking.m │ │ └── JSONModelTransformations │ │ │ ├── JSONKeyMapper.h │ │ │ ├── JSONKeyMapper.m │ │ │ ├── JSONValueTransformer.h │ │ │ └── JSONValueTransformer.m │ ├── LICENSE │ └── README.md ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── maksumon.xcuserdatad │ │ └── xcschemes │ │ ├── JSONModel.xcscheme │ │ ├── Pods-Stories.xcscheme │ │ ├── SDWebImage.xcscheme │ │ └── xcschememanagement.plist ├── SDWebImage │ ├── LICENSE │ ├── README.md │ ├── SDWebImage │ │ ├── NSButton+WebCache.h │ │ ├── NSButton+WebCache.m │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── NSImage+Compatibility.h │ │ ├── NSImage+Compatibility.m │ │ ├── Private │ │ │ ├── NSBezierPath+RoundedCorners.h │ │ │ ├── NSBezierPath+RoundedCorners.m │ │ │ ├── SDAsyncBlockOperation.h │ │ │ ├── SDAsyncBlockOperation.m │ │ │ ├── SDImageAPNGCoderInternal.h │ │ │ ├── SDImageAssetManager.h │ │ │ ├── SDImageAssetManager.m │ │ │ ├── SDImageCachesManagerOperation.h │ │ │ ├── SDImageCachesManagerOperation.m │ │ │ ├── SDImageGIFCoderInternal.h │ │ │ ├── SDInternalMacros.h │ │ │ ├── SDInternalMacros.m │ │ │ ├── SDWeakProxy.h │ │ │ ├── SDWeakProxy.m │ │ │ ├── SDmetamacros.h │ │ │ ├── UIColor+HexString.h │ │ │ └── UIColor+HexString.m │ │ ├── SDAnimatedImage.h │ │ ├── SDAnimatedImage.m │ │ ├── SDAnimatedImageRep.h │ │ ├── SDAnimatedImageRep.m │ │ ├── SDAnimatedImageView+WebCache.h │ │ ├── SDAnimatedImageView+WebCache.m │ │ ├── SDAnimatedImageView.h │ │ ├── SDAnimatedImageView.m │ │ ├── SDDiskCache.h │ │ ├── SDDiskCache.m │ │ ├── SDImageAPNGCoder.h │ │ ├── SDImageAPNGCoder.m │ │ ├── SDImageCache.h │ │ ├── SDImageCache.m │ │ ├── SDImageCacheConfig.h │ │ ├── SDImageCacheConfig.m │ │ ├── SDImageCacheDefine.h │ │ ├── SDImageCacheDefine.m │ │ ├── SDImageCachesManager.h │ │ ├── SDImageCachesManager.m │ │ ├── SDImageCoder.h │ │ ├── SDImageCoder.m │ │ ├── SDImageCoderHelper.h │ │ ├── SDImageCoderHelper.m │ │ ├── SDImageCodersManager.h │ │ ├── SDImageCodersManager.m │ │ ├── SDImageFrame.h │ │ ├── SDImageFrame.m │ │ ├── SDImageGIFCoder.h │ │ ├── SDImageGIFCoder.m │ │ ├── SDImageGraphics.h │ │ ├── SDImageGraphics.m │ │ ├── SDImageIOCoder.h │ │ ├── SDImageIOCoder.m │ │ ├── SDImageLoader.h │ │ ├── SDImageLoader.m │ │ ├── SDImageLoadersManager.h │ │ ├── SDImageLoadersManager.m │ │ ├── SDImageTransformer.h │ │ ├── SDImageTransformer.m │ │ ├── SDMemoryCache.h │ │ ├── SDMemoryCache.m │ │ ├── SDWebImageCacheKeyFilter.h │ │ ├── SDWebImageCacheKeyFilter.m │ │ ├── SDWebImageCacheSerializer.h │ │ ├── SDWebImageCacheSerializer.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDefine.h │ │ ├── SDWebImageDefine.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloader.m │ │ ├── SDWebImageDownloaderConfig.h │ │ ├── SDWebImageDownloaderConfig.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageDownloaderOperation.m │ │ ├── SDWebImageDownloaderRequestModifier.h │ │ ├── SDWebImageDownloaderRequestModifier.m │ │ ├── SDWebImageError.h │ │ ├── SDWebImageError.m │ │ ├── SDWebImageIndicator.h │ │ ├── SDWebImageIndicator.m │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageManager.m │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── SDWebImagePrefetcher.m │ │ ├── SDWebImageTransition.h │ │ ├── SDWebImageTransition.m │ │ ├── UIButton+WebCache.h │ │ ├── UIButton+WebCache.m │ │ ├── UIImage+ForceDecode.h │ │ ├── UIImage+ForceDecode.m │ │ ├── UIImage+GIF.h │ │ ├── UIImage+GIF.m │ │ ├── UIImage+MemoryCacheCost.h │ │ ├── UIImage+MemoryCacheCost.m │ │ ├── UIImage+Metadata.h │ │ ├── UIImage+Metadata.m │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImage+Transform.h │ │ ├── UIImage+Transform.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── UIImageView+WebCache.m │ │ ├── UIView+WebCache.h │ │ ├── UIView+WebCache.m │ │ ├── UIView+WebCacheOperation.h │ │ └── UIView+WebCacheOperation.m │ └── WebImage │ │ ├── SDWebImage.h │ │ └── SDWebImage.modulemap └── Target Support Files │ ├── JSONModel │ ├── JSONModel-Info.plist │ ├── JSONModel-dummy.m │ ├── JSONModel-prefix.pch │ ├── JSONModel-umbrella.h │ ├── JSONModel.modulemap │ └── JSONModel.xcconfig │ ├── Pods-Stories │ ├── Pods-Stories-Info.plist │ ├── Pods-Stories-acknowledgements.markdown │ ├── Pods-Stories-acknowledgements.plist │ ├── Pods-Stories-dummy.m │ ├── Pods-Stories-frameworks-Debug-input-files.xcfilelist │ ├── Pods-Stories-frameworks-Debug-output-files.xcfilelist │ ├── Pods-Stories-frameworks-Release-input-files.xcfilelist │ ├── Pods-Stories-frameworks-Release-output-files.xcfilelist │ ├── Pods-Stories-frameworks.sh │ ├── Pods-Stories-umbrella.h │ ├── Pods-Stories.debug.xcconfig │ ├── Pods-Stories.modulemap │ └── Pods-Stories.release.xcconfig │ └── SDWebImage │ ├── SDWebImage-Info.plist │ ├── SDWebImage-dummy.m │ ├── SDWebImage-prefix.pch │ ├── SDWebImage.modulemap │ └── SDWebImage.xcconfig ├── README.md ├── Stories.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── maksumon.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Stories.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── maksumon.xcuserdatad │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist └── Stories ├── ARStories ├── ContentViewController.swift ├── Extension │ └── ARSupport.swift ├── Helper │ ├── SegmentedProgressBar.swift │ └── usersCollectionViewCell.swift ├── Model │ ├── Content.h │ ├── Content.m │ ├── UserDetail.h │ ├── UserDetail.m │ ├── UserDetailCell.h │ └── UserDetailCell.m ├── PreViewController.swift └── Stories-Bridging-Header.h ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Close.imageset │ ├── Close@2x.png │ ├── Close@3x.png │ └── Contents.json └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── Resource └── user-details.json ├── ViewController.h ├── ViewController.m └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | 49 | Carthage/Build/ 50 | 51 | # fastlane 52 | # 53 | # It is recommended to not store the screenshots in the git repo. 54 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 55 | # For more information about the recommended setup visit: 56 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 57 | 58 | fastlane/report.xml 59 | fastlane/Preview.html 60 | fastlane/screenshots/**/*.png 61 | fastlane/test_output 62 | 63 | # Code Injection 64 | # 65 | # After new code Injection tools there's a generated folder /iOSInjectionProject 66 | # https://github.com/johnno1962/injectionforxcode 67 | 68 | iOSInjectionProject/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Mohammad Ashraful Kabir 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Stories' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for Stories 9 | pod 'JSONModel' 10 | pod 'SDWebImage', '~> 5.0' 11 | end 12 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - JSONModel (1.8.0) 3 | - SDWebImage (5.0.6): 4 | - SDWebImage/Core (= 5.0.6) 5 | - SDWebImage/Core (5.0.6) 6 | 7 | DEPENDENCIES: 8 | - JSONModel 9 | - SDWebImage (~> 5.0) 10 | 11 | SPEC REPOS: 12 | https://github.com/cocoapods/specs.git: 13 | - JSONModel 14 | - SDWebImage 15 | 16 | SPEC CHECKSUMS: 17 | JSONModel: 02ab723958366a3fd27da57ea2af2113658762e9 18 | SDWebImage: 920f1a2ff1ca8296ad34f6e0510a1ef1d70ac965 19 | 20 | PODFILE CHECKSUM: 4c4eecfaf7adef082e5d12c5df012f01678d7a16 21 | 22 | COCOAPODS: 1.7.5 23 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelClassProperty.h 3 | // JSONModel 4 | // 5 | 6 | #import 7 | 8 | /** 9 | * **You do not need to instantiate this class yourself.** This class is used internally by JSONModel 10 | * to inspect the declared properties of your model class. 11 | * 12 | * Class to contain the information, representing a class property 13 | * It features the property's name, type, whether it's a required property, 14 | * and (optionally) the class protocol 15 | */ 16 | @interface JSONModelClassProperty : NSObject 17 | 18 | // deprecated 19 | @property (assign, nonatomic) BOOL isIndex DEPRECATED_ATTRIBUTE; 20 | 21 | /** The name of the declared property (not the ivar name) */ 22 | @property (copy, nonatomic) NSString *name; 23 | 24 | /** A property class type */ 25 | @property (assign, nonatomic) Class type; 26 | 27 | /** Struct name if a struct */ 28 | @property (strong, nonatomic) NSString *structName; 29 | 30 | /** The name of the protocol the property conforms to (or nil) */ 31 | @property (copy, nonatomic) NSString *protocol; 32 | 33 | /** If YES, it can be missing in the input data, and the input would be still valid */ 34 | @property (assign, nonatomic) BOOL isOptional; 35 | 36 | /** If YES - don't call any transformers on this property's value */ 37 | @property (assign, nonatomic) BOOL isStandardJSONType; 38 | 39 | /** If YES - create a mutable object for the value of the property */ 40 | @property (assign, nonatomic) BOOL isMutable; 41 | 42 | /** a custom getter for this property, found in the owning model */ 43 | @property (assign, nonatomic) SEL customGetter; 44 | 45 | /** custom setters for this property, found in the owning model */ 46 | @property (strong, nonatomic) NSMutableDictionary *customSetters; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelClassProperty.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelClassProperty.m 3 | // JSONModel 4 | // 5 | 6 | #import "JSONModelClassProperty.h" 7 | 8 | @implementation JSONModelClassProperty 9 | 10 | -(NSString*)description 11 | { 12 | //build the properties string for the current class property 13 | NSMutableArray* properties = [NSMutableArray arrayWithCapacity:8]; 14 | 15 | #pragma GCC diagnostic push 16 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 17 | if (self.isIndex) [properties addObject:@"Index"]; 18 | #pragma GCC diagnostic pop 19 | 20 | if (self.isOptional) [properties addObject:@"Optional"]; 21 | if (self.isMutable) [properties addObject:@"Mutable"]; 22 | if (self.isStandardJSONType) [properties addObject:@"Standard JSON type"]; 23 | if (self.customGetter) [properties addObject:[NSString stringWithFormat: @"Getter = %@", NSStringFromSelector(self.customGetter)]]; 24 | 25 | if (self.customSetters) 26 | { 27 | NSMutableArray *setters = [NSMutableArray array]; 28 | 29 | for (id obj in self.customSetters.allValues) 30 | { 31 | SEL selector; 32 | [obj getValue:&selector]; 33 | [setters addObject:NSStringFromSelector(selector)]; 34 | } 35 | 36 | [properties addObject:[NSString stringWithFormat: @"Setters = [%@]", [setters componentsJoinedByString:@", "]]]; 37 | } 38 | 39 | NSString* propertiesString = @""; 40 | if (properties.count>0) { 41 | propertiesString = [NSString stringWithFormat:@"(%@)", [properties componentsJoinedByString:@", "]]; 42 | } 43 | 44 | //return the name, type and additional properties 45 | return [NSString stringWithFormat:@"@property %@%@ %@ %@", 46 | self.type?[NSString stringWithFormat:@"%@*",self.type]:(self.structName?self.structName:@"primitive"), 47 | self.protocol?[NSString stringWithFormat:@"<%@>", self.protocol]:@"", 48 | self.name, 49 | propertiesString 50 | ]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelError.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelError.h 3 | // JSONModel 4 | // 5 | 6 | #import 7 | 8 | ///////////////////////////////////////////////////////////////////////////////////////////// 9 | typedef NS_ENUM(int, kJSONModelErrorTypes) 10 | { 11 | kJSONModelErrorInvalidData = 1, 12 | kJSONModelErrorBadResponse = 2, 13 | kJSONModelErrorBadJSON = 3, 14 | kJSONModelErrorModelIsInvalid = 4, 15 | kJSONModelErrorNilInput = 5 16 | }; 17 | 18 | ///////////////////////////////////////////////////////////////////////////////////////////// 19 | /** The domain name used for the JSONModelError instances */ 20 | extern NSString *const JSONModelErrorDomain; 21 | 22 | /** 23 | * If the model JSON input misses keys that are required, check the 24 | * userInfo dictionary of the JSONModelError instance you get back - 25 | * under the kJSONModelMissingKeys key you will find a list of the 26 | * names of the missing keys. 27 | */ 28 | extern NSString *const kJSONModelMissingKeys; 29 | 30 | /** 31 | * If JSON input has a different type than expected by the model, check the 32 | * userInfo dictionary of the JSONModelError instance you get back - 33 | * under the kJSONModelTypeMismatch key you will find a description 34 | * of the mismatched types. 35 | */ 36 | extern NSString *const kJSONModelTypeMismatch; 37 | 38 | /** 39 | * If an error occurs in a nested model, check the userInfo dictionary of 40 | * the JSONModelError instance you get back - under the kJSONModelKeyPath 41 | * key you will find key-path at which the error occurred. 42 | */ 43 | extern NSString *const kJSONModelKeyPath; 44 | 45 | ///////////////////////////////////////////////////////////////////////////////////////////// 46 | /** 47 | * Custom NSError subclass with shortcut methods for creating 48 | * the common JSONModel errors 49 | */ 50 | @interface JSONModelError : NSError 51 | 52 | @property (strong, nonatomic) NSHTTPURLResponse *httpResponse; 53 | 54 | @property (strong, nonatomic) NSData *responseData; 55 | 56 | /** 57 | * Creates a JSONModelError instance with code kJSONModelErrorInvalidData = 1 58 | */ 59 | + (id)errorInvalidDataWithMessage:(NSString *)message; 60 | 61 | /** 62 | * Creates a JSONModelError instance with code kJSONModelErrorInvalidData = 1 63 | * @param keys a set of field names that were required, but not found in the input 64 | */ 65 | + (id)errorInvalidDataWithMissingKeys:(NSSet *)keys; 66 | 67 | /** 68 | * Creates a JSONModelError instance with code kJSONModelErrorInvalidData = 1 69 | * @param mismatchDescription description of the type mismatch that was encountered. 70 | */ 71 | + (id)errorInvalidDataWithTypeMismatch:(NSString *)mismatchDescription; 72 | 73 | /** 74 | * Creates a JSONModelError instance with code kJSONModelErrorBadResponse = 2 75 | */ 76 | + (id)errorBadResponse; 77 | 78 | /** 79 | * Creates a JSONModelError instance with code kJSONModelErrorBadJSON = 3 80 | */ 81 | + (id)errorBadJSON; 82 | 83 | /** 84 | * Creates a JSONModelError instance with code kJSONModelErrorModelIsInvalid = 4 85 | */ 86 | + (id)errorModelIsInvalid; 87 | 88 | /** 89 | * Creates a JSONModelError instance with code kJSONModelErrorNilInput = 5 90 | */ 91 | + (id)errorInputIsNil; 92 | 93 | /** 94 | * Creates a new JSONModelError with the same values plus information about the key-path of the error. 95 | * Properties in the new error object are the same as those from the receiver, 96 | * except that a new key kJSONModelKeyPath is added to the userInfo dictionary. 97 | * This key contains the component string parameter. If the key is already present 98 | * then the new error object has the component string prepended to the existing value. 99 | */ 100 | - (instancetype)errorByPrependingKeyPathComponent:(NSString *)component; 101 | 102 | ///////////////////////////////////////////////////////////////////////////////////////////// 103 | @end 104 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelError.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelError.m 3 | // JSONModel 4 | // 5 | 6 | #import "JSONModelError.h" 7 | 8 | NSString* const JSONModelErrorDomain = @"JSONModelErrorDomain"; 9 | NSString* const kJSONModelMissingKeys = @"kJSONModelMissingKeys"; 10 | NSString* const kJSONModelTypeMismatch = @"kJSONModelTypeMismatch"; 11 | NSString* const kJSONModelKeyPath = @"kJSONModelKeyPath"; 12 | 13 | @implementation JSONModelError 14 | 15 | +(id)errorInvalidDataWithMessage:(NSString*)message 16 | { 17 | message = [NSString stringWithFormat:@"Invalid JSON data: %@", message]; 18 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 19 | code:kJSONModelErrorInvalidData 20 | userInfo:@{NSLocalizedDescriptionKey:message}]; 21 | } 22 | 23 | +(id)errorInvalidDataWithMissingKeys:(NSSet *)keys 24 | { 25 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 26 | code:kJSONModelErrorInvalidData 27 | userInfo:@{NSLocalizedDescriptionKey:@"Invalid JSON data. Required JSON keys are missing from the input. Check the error user information.",kJSONModelMissingKeys:[keys allObjects]}]; 28 | } 29 | 30 | +(id)errorInvalidDataWithTypeMismatch:(NSString*)mismatchDescription 31 | { 32 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 33 | code:kJSONModelErrorInvalidData 34 | userInfo:@{NSLocalizedDescriptionKey:@"Invalid JSON data. The JSON type mismatches the expected type. Check the error user information.",kJSONModelTypeMismatch:mismatchDescription}]; 35 | } 36 | 37 | +(id)errorBadResponse 38 | { 39 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 40 | code:kJSONModelErrorBadResponse 41 | userInfo:@{NSLocalizedDescriptionKey:@"Bad network response. Probably the JSON URL is unreachable."}]; 42 | } 43 | 44 | +(id)errorBadJSON 45 | { 46 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 47 | code:kJSONModelErrorBadJSON 48 | userInfo:@{NSLocalizedDescriptionKey:@"Malformed JSON. Check the JSONModel data input."}]; 49 | } 50 | 51 | +(id)errorModelIsInvalid 52 | { 53 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 54 | code:kJSONModelErrorModelIsInvalid 55 | userInfo:@{NSLocalizedDescriptionKey:@"Model does not validate. The custom validation for the input data failed."}]; 56 | } 57 | 58 | +(id)errorInputIsNil 59 | { 60 | return [JSONModelError errorWithDomain:JSONModelErrorDomain 61 | code:kJSONModelErrorNilInput 62 | userInfo:@{NSLocalizedDescriptionKey:@"Initializing model with nil input object."}]; 63 | } 64 | 65 | - (instancetype)errorByPrependingKeyPathComponent:(NSString*)component 66 | { 67 | // Create a mutable copy of the user info so that we can add to it and update it 68 | NSMutableDictionary* userInfo = [self.userInfo mutableCopy]; 69 | 70 | // Create or update the key-path 71 | NSString* existingPath = userInfo[kJSONModelKeyPath]; 72 | NSString* separator = [existingPath hasPrefix:@"["] ? @"" : @"."; 73 | NSString* updatedPath = (existingPath == nil) ? component : [component stringByAppendingFormat:@"%@%@", separator, existingPath]; 74 | userInfo[kJSONModelKeyPath] = updatedPath; 75 | 76 | // Create the new error 77 | return [JSONModelError errorWithDomain:self.domain 78 | code:self.code 79 | userInfo:[NSDictionary dictionaryWithDictionary:userInfo]]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelLib.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelLib.h 3 | // JSONModel 4 | // 5 | 6 | #import 7 | 8 | // core 9 | #import "JSONModel.h" 10 | #import "JSONModelError.h" 11 | 12 | // transformations 13 | #import "JSONValueTransformer.h" 14 | #import "JSONKeyMapper.h" 15 | 16 | // networking (deprecated) 17 | #import "JSONHTTPClient.h" 18 | #import "JSONModel+networking.h" 19 | #import "JSONAPI.h" 20 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelNetworking/JSONAPI.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONAPI.h 3 | // JSONModel 4 | // 5 | 6 | #import 7 | #import "JSONHTTPClient.h" 8 | 9 | DEPRECATED_ATTRIBUTE 10 | @interface JSONAPI : NSObject 11 | 12 | + (void)setAPIBaseURLWithString:(NSString *)base DEPRECATED_ATTRIBUTE; 13 | + (void)setContentType:(NSString *)ctype DEPRECATED_ATTRIBUTE; 14 | + (void)getWithPath:(NSString *)path andParams:(NSDictionary *)params completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 15 | + (void)postWithPath:(NSString *)path andParams:(NSDictionary *)params completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 16 | + (void)rpcWithMethodName:(NSString *)method andArguments:(NSArray *)args completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 17 | + (void)rpc2WithMethodName:(NSString *)method andParams:(id)params completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelNetworking/JSONHTTPClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelHTTPClient.h 3 | // JSONModel 4 | // 5 | 6 | #import "JSONModel.h" 7 | 8 | extern NSString *const kHTTPMethodGET DEPRECATED_ATTRIBUTE; 9 | extern NSString *const kHTTPMethodPOST DEPRECATED_ATTRIBUTE; 10 | extern NSString *const kContentTypeAutomatic DEPRECATED_ATTRIBUTE; 11 | extern NSString *const kContentTypeJSON DEPRECATED_ATTRIBUTE; 12 | extern NSString *const kContentTypeWWWEncoded DEPRECATED_ATTRIBUTE; 13 | 14 | typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBUTE; 15 | 16 | DEPRECATED_ATTRIBUTE 17 | @interface JSONHTTPClient : NSObject 18 | 19 | + (NSMutableDictionary *)requestHeaders DEPRECATED_ATTRIBUTE; 20 | + (void)setDefaultTextEncoding:(NSStringEncoding)encoding DEPRECATED_ATTRIBUTE; 21 | + (void)setCachingPolicy:(NSURLRequestCachePolicy)policy DEPRECATED_ATTRIBUTE; 22 | + (void)setTimeoutInSeconds:(int)seconds DEPRECATED_ATTRIBUTE; 23 | + (void)setRequestContentType:(NSString *)contentTypeString DEPRECATED_ATTRIBUTE; 24 | + (void)getJSONFromURLWithString:(NSString *)urlString completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 25 | + (void)getJSONFromURLWithString:(NSString *)urlString params:(NSDictionary *)params completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 26 | + (void)JSONFromURLWithString:(NSString *)urlString method:(NSString *)method params:(NSDictionary *)params orBodyString:(NSString *)bodyString completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 27 | + (void)JSONFromURLWithString:(NSString *)urlString method:(NSString *)method params:(NSDictionary *)params orBodyString:(NSString *)bodyString headers:(NSDictionary *)headers completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 28 | + (void)JSONFromURLWithString:(NSString *)urlString method:(NSString *)method params:(NSDictionary *)params orBodyData:(NSData *)bodyData headers:(NSDictionary *)headers completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 29 | + (void)postJSONFromURLWithString:(NSString *)urlString params:(NSDictionary *)params completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 30 | + (void)postJSONFromURLWithString:(NSString *)urlString bodyString:(NSString *)bodyString completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 31 | + (void)postJSONFromURLWithString:(NSString *)urlString bodyData:(NSData *)bodyData completion:(JSONObjectBlock)completeBlock DEPRECATED_ATTRIBUTE; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModel+networking.h 3 | // JSONModel 4 | // 5 | 6 | #import "JSONModel.h" 7 | #import "JSONHTTPClient.h" 8 | 9 | typedef void (^JSONModelBlock)(id model, JSONModelError *err) DEPRECATED_ATTRIBUTE; 10 | 11 | @interface JSONModel (Networking) 12 | 13 | @property (assign, nonatomic) BOOL isLoading DEPRECATED_ATTRIBUTE; 14 | - (instancetype)initFromURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock DEPRECATED_ATTRIBUTE; 15 | + (void)getModelFromURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock DEPRECATED_ATTRIBUTE; 16 | + (void)postModel:(JSONModel *)post toURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock DEPRECATED_ATTRIBUTE; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModel+networking.m 3 | // JSONModel 4 | // 5 | 6 | #import "JSONModel+networking.h" 7 | #import "JSONHTTPClient.h" 8 | 9 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 10 | #pragma GCC diagnostic ignored "-Wdeprecated-implementations" 11 | 12 | BOOL _isLoading; 13 | 14 | @implementation JSONModel(Networking) 15 | 16 | @dynamic isLoading; 17 | 18 | -(BOOL)isLoading 19 | { 20 | return _isLoading; 21 | } 22 | 23 | -(void)setIsLoading:(BOOL)isLoading 24 | { 25 | _isLoading = isLoading; 26 | } 27 | 28 | -(instancetype)initFromURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock 29 | { 30 | id placeholder = [super init]; 31 | __block id blockSelf = self; 32 | 33 | if (placeholder) { 34 | //initialization 35 | self.isLoading = YES; 36 | 37 | [JSONHTTPClient getJSONFromURLWithString:urlString 38 | completion:^(NSDictionary *json, JSONModelError* e) { 39 | 40 | JSONModelError* initError = nil; 41 | blockSelf = [self initWithDictionary:json error:&initError]; 42 | 43 | if (completeBlock) { 44 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ 45 | completeBlock(blockSelf, e?e:initError ); 46 | }); 47 | } 48 | 49 | self.isLoading = NO; 50 | 51 | }]; 52 | } 53 | return placeholder; 54 | } 55 | 56 | + (void)getModelFromURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock 57 | { 58 | [JSONHTTPClient getJSONFromURLWithString:urlString 59 | completion:^(NSDictionary* jsonDict, JSONModelError* err) 60 | { 61 | JSONModel* model = nil; 62 | 63 | if(err == nil) 64 | { 65 | model = [[self alloc] initWithDictionary:jsonDict error:&err]; 66 | } 67 | 68 | if(completeBlock != nil) 69 | { 70 | dispatch_async(dispatch_get_main_queue(), ^ 71 | { 72 | completeBlock(model, err); 73 | }); 74 | } 75 | }]; 76 | } 77 | 78 | + (void)postModel:(JSONModel*)post toURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock 79 | { 80 | [JSONHTTPClient postJSONFromURLWithString:urlString 81 | bodyString:[post toJSONString] 82 | completion:^(NSDictionary* jsonDict, JSONModelError* err) 83 | { 84 | JSONModel* model = nil; 85 | 86 | if(err == nil) 87 | { 88 | model = [[self alloc] initWithDictionary:jsonDict error:&err]; 89 | } 90 | 91 | if(completeBlock != nil) 92 | { 93 | dispatch_async(dispatch_get_main_queue(), ^ 94 | { 95 | completeBlock(model, err); 96 | }); 97 | } 98 | }]; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelTransformations/JSONKeyMapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONKeyMapper.h 3 | // JSONModel 4 | // 5 | 6 | #import 7 | 8 | typedef NSString *(^JSONModelKeyMapBlock)(NSString *keyName); 9 | 10 | /** 11 | * **You won't need to create or store instances of this class yourself.** If you want your model 12 | * to have different property names than the JSON feed keys, look below on how to 13 | * make your model use a key mapper. 14 | * 15 | * For example if you consume JSON from twitter 16 | * you get back underscore_case style key names. For example: 17 | * 18 | *
"profile_sidebar_border_color": "0094C2",
19 |  * "profile_background_tile": false,
20 | * 21 | * To comply with Obj-C accepted camelCase property naming for your classes, 22 | * you need to provide mapping between JSON keys and ObjC property names. 23 | * 24 | * In your model overwrite the + (JSONKeyMapper *)keyMapper method and provide a JSONKeyMapper 25 | * instance to convert the key names for your model. 26 | * 27 | * If you need custom mapping it's as easy as: 28 | *
29 |  * + (JSONKeyMapper *)keyMapper {
30 |  *   return [[JSONKeyMapper alloc] initWithDictionary:@{@"crazy_JSON_name":@"myCamelCaseName"}];
31 |  * }
32 |  * 
33 | * In case you want to handle underscore_case, **use the predefined key mapper**, like so: 34 | *
35 |  * + (JSONKeyMapper *)keyMapper {
36 |  *   return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
37 |  * }
38 |  * 
39 | */ 40 | @interface JSONKeyMapper : NSObject 41 | 42 | // deprecated 43 | @property (readonly, nonatomic) JSONModelKeyMapBlock JSONToModelKeyBlock DEPRECATED_ATTRIBUTE; 44 | - (NSString *)convertValue:(NSString *)value isImportingToModel:(BOOL)importing DEPRECATED_MSG_ATTRIBUTE("use convertValue:"); 45 | - (instancetype)initWithDictionary:(NSDictionary *)map DEPRECATED_MSG_ATTRIBUTE("use initWithModelToJSONDictionary:"); 46 | - (instancetype)initWithJSONToModelBlock:(JSONModelKeyMapBlock)toModel modelToJSONBlock:(JSONModelKeyMapBlock)toJSON DEPRECATED_MSG_ATTRIBUTE("use initWithModelToJSONBlock:"); 47 | + (instancetype)mapper:(JSONKeyMapper *)baseKeyMapper withExceptions:(NSDictionary *)exceptions DEPRECATED_MSG_ATTRIBUTE("use baseMapper:withModelToJSONExceptions:"); 48 | + (instancetype)mapperFromUnderscoreCaseToCamelCase DEPRECATED_MSG_ATTRIBUTE("use mapperForSnakeCase:"); 49 | + (instancetype)mapperFromUpperCaseToLowerCase DEPRECATED_ATTRIBUTE; 50 | 51 | /** @name Name converters */ 52 | /** Block, which takes in a property name and converts it to the corresponding JSON key name */ 53 | @property (readonly, nonatomic) JSONModelKeyMapBlock modelToJSONKeyBlock; 54 | 55 | /** Combined converter method 56 | * @param value the source name 57 | * @return JSONKeyMapper instance 58 | */ 59 | - (NSString *)convertValue:(NSString *)value; 60 | 61 | /** @name Creating a key mapper */ 62 | 63 | /** 64 | * Creates a JSONKeyMapper instance, based on the block you provide this initializer. 65 | * The parameter takes in a JSONModelKeyMapBlock block: 66 | *
NSString *(^JSONModelKeyMapBlock)(NSString *keyName)
67 | * The block takes in a string and returns the transformed (if at all) string. 68 | * @param toJSON transforms your model property name to a JSON key 69 | */ 70 | - (instancetype)initWithModelToJSONBlock:(JSONModelKeyMapBlock)toJSON; 71 | 72 | /** 73 | * Creates a JSONKeyMapper instance, based on the mapping you provide. 74 | * Use your JSONModel property names as keys, and the JSON key names as values. 75 | * @param toJSON map dictionary, in the format:
@{@"myCamelCaseName":@"crazy_JSON_name"}
76 | * @return JSONKeyMapper instance 77 | */ 78 | - (instancetype)initWithModelToJSONDictionary:(NSDictionary *)toJSON; 79 | 80 | /** 81 | * Given a camelCase model property, this mapper finds JSON keys using the snake_case equivalent. 82 | */ 83 | + (instancetype)mapperForSnakeCase; 84 | 85 | /** 86 | * Given a camelCase model property, this mapper finds JSON keys using the TitleCase equivalent. 87 | */ 88 | + (instancetype)mapperForTitleCase; 89 | 90 | /** 91 | * Creates a JSONKeyMapper based on a built-in JSONKeyMapper, with specific exceptions. 92 | * Use your JSONModel property names as keys, and the JSON key names as values. 93 | */ 94 | + (instancetype)baseMapper:(JSONKeyMapper *)baseKeyMapper withModelToJSONExceptions:(NSDictionary *)toJSON; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Pods/JSONModel/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2016 Marin Todorov and JSONModel contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | 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, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - JSONModel (1.8.0) 3 | - SDWebImage (5.0.6): 4 | - SDWebImage/Core (= 5.0.6) 5 | - SDWebImage/Core (5.0.6) 6 | 7 | DEPENDENCIES: 8 | - JSONModel 9 | - SDWebImage (~> 5.0) 10 | 11 | SPEC REPOS: 12 | https://github.com/cocoapods/specs.git: 13 | - JSONModel 14 | - SDWebImage 15 | 16 | SPEC CHECKSUMS: 17 | JSONModel: 02ab723958366a3fd27da57ea2af2113658762e9 18 | SDWebImage: 920f1a2ff1ca8296ad34f6e0510a1ef1d70ac965 19 | 20 | PODFILE CHECKSUM: 4c4eecfaf7adef082e5d12c5df012f01678d7a16 21 | 22 | COCOAPODS: 1.7.5 23 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/maksumon.xcuserdatad/xcschemes/JSONModel.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/Pods.xcodeproj/xcuserdata/maksumon.xcuserdatad/xcschemes/Pods-Stories.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/maksumon.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/Pods.xcodeproj/xcuserdata/maksumon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONModel.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Pods-Stories.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | SDWebImage.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2018 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/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 | /** 14 | You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value. 15 | For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information. 16 | */ 17 | typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM; 18 | static const SDImageFormat SDImageFormatUndefined = -1; 19 | static const SDImageFormat SDImageFormatJPEG = 0; 20 | static const SDImageFormat SDImageFormatPNG = 1; 21 | static const SDImageFormat SDImageFormatGIF = 2; 22 | static const SDImageFormat SDImageFormatTIFF = 3; 23 | static const SDImageFormat SDImageFormatWebP = 4; 24 | static const SDImageFormat SDImageFormatHEIC = 5; 25 | static const SDImageFormat SDImageFormatHEIF = 6; 26 | 27 | /** 28 | NSData category about the image content type and UTI. 29 | */ 30 | @interface NSData (ImageContentType) 31 | 32 | /** 33 | * Return image format 34 | * 35 | * @param data the input image data 36 | * 37 | * @return the image format as `SDImageFormat` (enum) 38 | */ 39 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 40 | 41 | /** 42 | * Convert SDImageFormat to UTType 43 | * 44 | * @param format Format as SDImageFormat 45 | * @return The UTType as CFStringRef 46 | */ 47 | + (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:)); 48 | 49 | /** 50 | * Convert UTTyppe to SDImageFormat 51 | * 52 | * @param uttype The UTType as CFStringRef 53 | * @return The Format as SDImageFormat 54 | */ 55 | + (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSImage+Compatibility.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 | /** 14 | This category is provided to easily write cross-platform(AppKit/UIKit) code. For common usage, see `UIImage+Metadata.h`. 15 | */ 16 | @interface NSImage (Compatibility) 17 | 18 | /** 19 | The underlying Core Graphics image object. This will actually use `CGImageForProposedRect` with the image size. 20 | */ 21 | @property (nonatomic, readonly, nullable) CGImageRef CGImage; 22 | /** 23 | The scale factor of the image. This wil actually use `bestRepresentationForRect` with image size and pixel size to calculate the scale factor. If failed, use the default value 1.0. Should be greater than or equal to 1.0. 24 | */ 25 | @property (nonatomic, readonly) CGFloat scale; 26 | 27 | // These are convenience methods to make AppKit's `NSImage` match UIKit's `UIImage` behavior. The scale factor should be greater than or equal to 1.0. 28 | 29 | /** 30 | Returns an image object with the scale factor and orientation. The representation is created from the Core Graphics image object. 31 | @note The difference between this and `initWithCGImage:size` is that `initWithCGImage:size` will actually create a `NSCGImageSnapshotRep` representation and always use `backingScaleFactor` as scale factor. So we should avoid it and use `NSBitmapImageRep` with `initWithCGImage:` instead. 32 | @note The difference between this and UIKit's `UIImage` equivalent method is the way to process orientation. If the provided image orientation is not equal to Up orientation, this method will firstly rotate the CGImage to the correct orientation to work compatible with `NSImageView`. However, UIKit will not actually rotate CGImage and just store it as `imageOrientation` property. 33 | 34 | @param cgImage A Core Graphics image object 35 | @param scale The image scale factor 36 | @param orientation The orientation of the image data 37 | @return The image object 38 | */ 39 | - (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation; 40 | 41 | /** 42 | Returns an image object with the scale factor. The representation is created from the image data. 43 | @note The difference between these this and `initWithData:` is that `initWithData:` will always use `backingScaleFactor` as scale factor. 44 | 45 | @param data The image data 46 | @param scale The image scale factor 47 | @return The image object 48 | */ 49 | - (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale; 50 | 51 | @end 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSImage+Compatibility.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+Compatibility.h" 10 | 11 | #if SD_MAC 12 | 13 | #import "SDImageCoderHelper.h" 14 | 15 | @implementation NSImage (Compatibility) 16 | 17 | - (CGImageRef)CGImage { 18 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 19 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:nil hints:nil]; 20 | return cgImage; 21 | } 22 | 23 | - (CGFloat)scale { 24 | CGFloat scale = 1; 25 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 26 | NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; 27 | CGFloat width = imageRep.size.width; 28 | CGFloat height = imageRep.size.height; 29 | NSUInteger pixelWidth = imageRep.pixelsWide; 30 | NSUInteger pixelHeight = imageRep.pixelsHigh; 31 | if (width > 0 && height > 0) { 32 | CGFloat widthScale = pixelWidth / width; 33 | CGFloat heightScale = pixelHeight / height; 34 | if (widthScale == heightScale && widthScale >= 1) { 35 | // Protect because there may be `NSImageRepMatchesDevice` (0) 36 | scale = widthScale; 37 | } 38 | } 39 | 40 | return scale; 41 | } 42 | 43 | - (instancetype)initWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation { 44 | NSBitmapImageRep *imageRep; 45 | if (orientation != kCGImagePropertyOrientationUp) { 46 | // AppKit design is different from UIKit. Where CGImage based image rep does not respect to any orientation. Only data based image rep which contains the EXIF metadata can automatically detect orientation. 47 | // This should be nonnull, until the memory is exhausted cause `CGBitmapContextCreate` failed. 48 | CGImageRef rotatedCGImage = [SDImageCoderHelper CGImageCreateDecoded:cgImage orientation:orientation]; 49 | imageRep = [[NSBitmapImageRep alloc] initWithCGImage:rotatedCGImage]; 50 | CGImageRelease(rotatedCGImage); 51 | } else { 52 | imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; 53 | } 54 | if (scale < 1) { 55 | scale = 1; 56 | } 57 | CGFloat pixelWidth = imageRep.pixelsWide; 58 | CGFloat pixelHeight = imageRep.pixelsHigh; 59 | NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); 60 | self = [self initWithSize:size]; 61 | if (self) { 62 | imageRep.size = size; 63 | [self addRepresentation:imageRep]; 64 | } 65 | return self; 66 | } 67 | 68 | - (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale { 69 | NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithData:data]; 70 | if (!imageRep) { 71 | return nil; 72 | } 73 | if (scale < 1) { 74 | scale = 1; 75 | } 76 | CGFloat pixelWidth = imageRep.pixelsWide; 77 | CGFloat pixelHeight = imageRep.pixelsHigh; 78 | NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); 79 | self = [self initWithSize:size]; 80 | if (self) { 81 | imageRep.size = size; 82 | [self addRepresentation:imageRep]; 83 | } 84 | return self; 85 | } 86 | 87 | @end 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/NSBezierPath+RoundedCorners.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 "UIImage+Transform.h" 14 | 15 | @interface NSBezierPath (RoundedCorners) 16 | 17 | /** 18 | Convenience way to create a bezier path with the specify rounding corners on macOS. Same as the one on `UIBezierPath`. 19 | */ 20 | + (nonnull instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius; 21 | 22 | @end 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/NSBezierPath+RoundedCorners.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 "NSBezierPath+RoundedCorners.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSBezierPath (RoundedCorners) 14 | 15 | + (instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius { 16 | NSBezierPath *path = [NSBezierPath bezierPath]; 17 | 18 | CGFloat maxCorner = MIN(NSWidth(rect), NSHeight(rect)) / 2; 19 | 20 | CGFloat topLeftRadius = MIN(maxCorner, (corners & SDRectCornerTopLeft) ? cornerRadius : 0); 21 | CGFloat topRightRadius = MIN(maxCorner, (corners & SDRectCornerTopRight) ? cornerRadius : 0); 22 | CGFloat bottomLeftRadius = MIN(maxCorner, (corners & SDRectCornerBottomLeft) ? cornerRadius : 0); 23 | CGFloat bottomRightRadius = MIN(maxCorner, (corners & SDRectCornerBottomRight) ? cornerRadius : 0); 24 | 25 | NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); 26 | NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); 27 | NSPoint bottomLeft = NSMakePoint(NSMinX(rect), NSMinY(rect)); 28 | NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect)); 29 | 30 | [path moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))]; 31 | [path appendBezierPathWithArcFromPoint:topLeft toPoint:bottomLeft radius:topLeftRadius]; 32 | [path appendBezierPathWithArcFromPoint:bottomLeft toPoint:bottomRight radius:bottomLeftRadius]; 33 | [path appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:bottomRightRadius]; 34 | [path appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:topRightRadius]; 35 | [path closePath]; 36 | 37 | return path; 38 | } 39 | 40 | @end 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.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 | @class SDAsyncBlockOperation; 12 | typedef void (^SDAsyncBlock)(SDAsyncBlockOperation * __nonnull asyncOperation); 13 | 14 | @interface SDAsyncBlockOperation : NSOperation 15 | 16 | - (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block; 17 | + (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block; 18 | - (void)complete; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.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 "SDAsyncBlockOperation.h" 10 | 11 | @interface SDAsyncBlockOperation () 12 | 13 | @property (assign, nonatomic, getter = isExecuting) BOOL executing; 14 | @property (assign, nonatomic, getter = isFinished) BOOL finished; 15 | @property (nonatomic, copy, nonnull) SDAsyncBlock executionBlock; 16 | 17 | @end 18 | 19 | @implementation SDAsyncBlockOperation 20 | 21 | @synthesize executing = _executing; 22 | @synthesize finished = _finished; 23 | 24 | - (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block { 25 | self = [super init]; 26 | if (self) { 27 | self.executionBlock = block; 28 | } 29 | return self; 30 | } 31 | 32 | + (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block { 33 | SDAsyncBlockOperation *operation = [[SDAsyncBlockOperation alloc] initWithBlock:block]; 34 | return operation; 35 | } 36 | 37 | - (void)start { 38 | if (self.isCancelled) { 39 | return; 40 | } 41 | 42 | [self willChangeValueForKey:@"isExecuting"]; 43 | self.executing = YES; 44 | [self didChangeValueForKey:@"isExecuting"]; 45 | 46 | if (self.executionBlock) { 47 | self.executionBlock(self); 48 | } else { 49 | [self complete]; 50 | } 51 | } 52 | 53 | - (void)cancel { 54 | [super cancel]; 55 | [self complete]; 56 | } 57 | 58 | - (void)complete { 59 | [self willChangeValueForKey:@"isExecuting"]; 60 | [self willChangeValueForKey:@"isFinished"]; 61 | self.executing = NO; 62 | self.finished = YES; 63 | [self didChangeValueForKey:@"isExecuting"]; 64 | [self didChangeValueForKey:@"isFinished"]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDImageAPNGCoderInternal.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 "SDImageAPNGCoder.h" 11 | 12 | @interface SDImageAPNGCoder () 13 | 14 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source; 15 | - (NSUInteger)sd_imageLoopCountWithSource:(nonnull CGImageSourceRef)source; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.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 | // Apple parse the Asset Catalog compiled file(`Assets.car`) by CoreUI.framework, however it's a private framework and there are no other ways to directly get the data. So we just process the normal bundle files :) 13 | 14 | @interface SDImageAssetManager : NSObject 15 | 16 | @property (nonatomic, strong, nonnull) NSMapTable *imageTable; 17 | 18 | + (nonnull instancetype)sharedAssetManager; 19 | - (nullable NSString *)getPathForName:(nonnull NSString *)name bundle:(nonnull NSBundle *)bundle preferredScale:(nonnull CGFloat *)scale; 20 | - (nullable UIImage *)imageForName:(nonnull NSString *)name; 21 | - (void)storeImage:(nonnull UIImage *)image forName:(nonnull NSString *)name; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.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 | // This is used for operation management, but not for operation queue execute 13 | @interface SDImageCachesManagerOperation : NSOperation 14 | 15 | @property (nonatomic, assign, readonly) NSUInteger pendingCount; 16 | 17 | - (void)beginWithTotalCount:(NSUInteger)totalCount; 18 | - (void)completeOne; 19 | - (void)done; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.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 "SDImageCachesManagerOperation.h" 10 | #import "SDInternalMacros.h" 11 | 12 | @implementation SDImageCachesManagerOperation 13 | { 14 | dispatch_semaphore_t _pendingCountLock; 15 | } 16 | 17 | @synthesize executing = _executing; 18 | @synthesize finished = _finished; 19 | @synthesize cancelled = _cancelled; 20 | @synthesize pendingCount = _pendingCount; 21 | 22 | - (instancetype)init { 23 | if (self = [super init]) { 24 | _pendingCountLock = dispatch_semaphore_create(1); 25 | _pendingCount = 0; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)beginWithTotalCount:(NSUInteger)totalCount { 31 | self.executing = YES; 32 | self.finished = NO; 33 | _pendingCount = totalCount; 34 | } 35 | 36 | - (NSUInteger)pendingCount { 37 | SD_LOCK(_pendingCountLock); 38 | NSUInteger pendingCount = _pendingCount; 39 | SD_UNLOCK(_pendingCountLock); 40 | return pendingCount; 41 | } 42 | 43 | - (void)completeOne { 44 | SD_LOCK(_pendingCountLock); 45 | _pendingCount = _pendingCount > 0 ? _pendingCount - 1 : 0; 46 | SD_UNLOCK(_pendingCountLock); 47 | } 48 | 49 | - (void)cancel { 50 | self.cancelled = YES; 51 | [self reset]; 52 | } 53 | 54 | - (void)done { 55 | self.finished = YES; 56 | self.executing = NO; 57 | [self reset]; 58 | } 59 | 60 | - (void)reset { 61 | SD_LOCK(_pendingCountLock); 62 | _pendingCount = 0; 63 | SD_UNLOCK(_pendingCountLock); 64 | } 65 | 66 | - (void)setFinished:(BOOL)finished { 67 | [self willChangeValueForKey:@"isFinished"]; 68 | _finished = finished; 69 | [self didChangeValueForKey:@"isFinished"]; 70 | } 71 | 72 | - (void)setExecuting:(BOOL)executing { 73 | [self willChangeValueForKey:@"isExecuting"]; 74 | _executing = executing; 75 | [self didChangeValueForKey:@"isExecuting"]; 76 | } 77 | 78 | - (void)setCancelled:(BOOL)cancelled { 79 | [self willChangeValueForKey:@"isCancelled"]; 80 | _cancelled = cancelled; 81 | [self didChangeValueForKey:@"isCancelled"]; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDImageGIFCoderInternal.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 "SDImageGIFCoder.h" 11 | 12 | @interface SDImageGIFCoder () 13 | 14 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.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 "SDmetamacros.h" 11 | 12 | #ifndef SD_LOCK 13 | #define SD_LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); 14 | #endif 15 | 16 | #ifndef SD_UNLOCK 17 | #define SD_UNLOCK(lock) dispatch_semaphore_signal(lock); 18 | #endif 19 | 20 | #ifndef weakify 21 | #define weakify(...) \ 22 | sd_keywordify \ 23 | metamacro_foreach_cxt(sd_weakify_,, __weak, __VA_ARGS__) 24 | #endif 25 | 26 | #ifndef strongify 27 | #define strongify(...) \ 28 | sd_keywordify \ 29 | _Pragma("clang diagnostic push") \ 30 | _Pragma("clang diagnostic ignored \"-Wshadow\"") \ 31 | metamacro_foreach(sd_strongify_,, __VA_ARGS__) \ 32 | _Pragma("clang diagnostic pop") 33 | #endif 34 | 35 | #define sd_weakify_(INDEX, CONTEXT, VAR) \ 36 | CONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR); 37 | 38 | #define sd_strongify_(INDEX, VAR) \ 39 | __strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_); 40 | 41 | #if DEBUG 42 | #define sd_keywordify autoreleasepool {} 43 | #else 44 | #define sd_keywordify try {} @catch (...) {} 45 | #endif 46 | 47 | #ifndef onExit 48 | #define onExit \ 49 | sd_keywordify \ 50 | __strong sd_cleanupBlock_t metamacro_concat(sd_exitBlock_, __LINE__) __attribute__((cleanup(sd_executeCleanupBlock), unused)) = ^ 51 | #endif 52 | 53 | typedef void (^sd_cleanupBlock_t)(void); 54 | 55 | #if defined(__cplusplus) 56 | extern "C" { 57 | #endif 58 | void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block); 59 | #if defined(__cplusplus) 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.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 "SDInternalMacros.h" 10 | 11 | void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block) { 12 | (*block)(); 13 | } 14 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.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 SDWeakProxy : NSProxy 13 | 14 | @property (nonatomic, weak, readonly, nullable) id target; 15 | 16 | - (nonnull instancetype)initWithTarget:(nonnull id)target; 17 | + (nonnull instancetype)proxyWithTarget:(nonnull id)target; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.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 "SDWeakProxy.h" 10 | 11 | @implementation SDWeakProxy 12 | 13 | - (instancetype)initWithTarget:(id)target { 14 | _target = target; 15 | return self; 16 | } 17 | 18 | + (instancetype)proxyWithTarget:(id)target { 19 | return [[SDWeakProxy alloc] initWithTarget:target]; 20 | } 21 | 22 | - (id)forwardingTargetForSelector:(SEL)selector { 23 | return _target; 24 | } 25 | 26 | - (void)forwardInvocation:(NSInvocation *)invocation { 27 | void *null = NULL; 28 | [invocation setReturnValue:&null]; 29 | } 30 | 31 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { 32 | return [NSObject instanceMethodSignatureForSelector:@selector(init)]; 33 | } 34 | 35 | - (BOOL)respondsToSelector:(SEL)aSelector { 36 | return [_target respondsToSelector:aSelector]; 37 | } 38 | 39 | - (BOOL)isEqual:(id)object { 40 | return [_target isEqual:object]; 41 | } 42 | 43 | - (NSUInteger)hash { 44 | return [_target hash]; 45 | } 46 | 47 | - (Class)superclass { 48 | return [_target superclass]; 49 | } 50 | 51 | - (Class)class { 52 | return [_target class]; 53 | } 54 | 55 | - (BOOL)isKindOfClass:(Class)aClass { 56 | return [_target isKindOfClass:aClass]; 57 | } 58 | 59 | - (BOOL)isMemberOfClass:(Class)aClass { 60 | return [_target isMemberOfClass:aClass]; 61 | } 62 | 63 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol { 64 | return [_target conformsToProtocol:aProtocol]; 65 | } 66 | 67 | - (BOOL)isProxy { 68 | return YES; 69 | } 70 | 71 | - (NSString *)description { 72 | return [_target description]; 73 | } 74 | 75 | - (NSString *)debugDescription { 76 | return [_target debugDescription]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/UIColor+HexString.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 | @interface UIColor (HexString) 12 | 13 | /** 14 | Convenience way to get hex string from color. The output should always be 32-bit RGBA hex string like `#00000000`. 15 | */ 16 | @property (nonatomic, copy, readonly, nonnull) NSString *sd_hexString; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/Private/UIColor+HexString.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 "UIColor+HexString.h" 10 | 11 | @implementation UIColor (HexString) 12 | 13 | - (NSString *)sd_hexString { 14 | CGFloat red, green, blue, alpha; 15 | #if SD_UIKIT 16 | if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) { 17 | [self getWhite:&red alpha:&alpha]; 18 | green = red; 19 | blue = red; 20 | } 21 | #else 22 | @try { 23 | [self getRed:&red green:&green blue:&blue alpha:&alpha]; 24 | } 25 | @catch (NSException *exception) { 26 | [self getWhite:&red alpha:&alpha]; 27 | green = red; 28 | blue = red; 29 | } 30 | #endif 31 | 32 | red = roundf(red * 255.f); 33 | green = roundf(green * 255.f); 34 | blue = roundf(blue * 255.f); 35 | alpha = roundf(alpha * 255.f); 36 | 37 | uint hex = ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue); 38 | 39 | return [NSString stringWithFormat:@"#%08x", hex]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.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 | /** 14 | A subclass of `NSBitmapImageRep` to fix that GIF loop count issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`. 15 | Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image. 16 | This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`. 17 | */ 18 | @interface SDAnimatedImageRep : NSBitmapImageRep 19 | 20 | @end 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.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 "SDAnimatedImageRep.h" 10 | 11 | #if SD_MAC 12 | 13 | #import "SDImageGIFCoderInternal.h" 14 | #import "SDImageAPNGCoderInternal.h" 15 | 16 | @implementation SDAnimatedImageRep { 17 | CGImageSourceRef _imageSource; 18 | } 19 | 20 | - (void)dealloc { 21 | if (_imageSource) { 22 | CFRelease(_imageSource); 23 | _imageSource = NULL; 24 | } 25 | } 26 | 27 | // `NSBitmapImageRep`'s `imageRepWithData:` is not designed initlizer 28 | + (instancetype)imageRepWithData:(NSData *)data { 29 | SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; 30 | return imageRep; 31 | } 32 | 33 | // We should override init method for `NSBitmapImageRep` to do initlize about animated image format 34 | - (instancetype)initWithData:(NSData *)data { 35 | self = [super initWithData:data]; 36 | if (self) { 37 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef) data, NULL); 38 | if (!imageSource) { 39 | return self; 40 | } 41 | _imageSource = imageSource; 42 | NSUInteger frameCount = CGImageSourceGetCount(imageSource); 43 | if (frameCount <= 1) { 44 | return self; 45 | } 46 | CFStringRef type = CGImageSourceGetType(imageSource); 47 | if (!type) { 48 | return self; 49 | } 50 | if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) { 51 | // GIF 52 | // Do nothing because NSBitmapImageRep support it 53 | } else if (CFStringCompare(type, kUTTypePNG, 0) == kCFCompareEqualTo) { 54 | // APNG 55 | // Do initilize about frame count, current frame/duration and loop count 56 | [self setProperty:NSImageFrameCount withValue:@(frameCount)]; 57 | [self setProperty:NSImageCurrentFrame withValue:@(0)]; 58 | NSUInteger loopCount = [[SDImageAPNGCoder sharedCoder] sd_imageLoopCountWithSource:imageSource]; 59 | [self setProperty:NSImageLoopCount withValue:@(loopCount)]; 60 | } 61 | } 62 | return self; 63 | } 64 | 65 | // `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need. 66 | - (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value { 67 | [super setProperty:property withValue:value]; 68 | if ([property isEqualToString:NSImageCurrentFrame]) { 69 | // Access the image source 70 | CGImageSourceRef imageSource = _imageSource; 71 | if (!imageSource) { 72 | return; 73 | } 74 | // Check format type 75 | CFStringRef type = CGImageSourceGetType(imageSource); 76 | if (!type) { 77 | return; 78 | } 79 | NSUInteger index = [value unsignedIntegerValue]; 80 | float frameDuration = 0; 81 | if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) { 82 | // GIF 83 | frameDuration = [[SDImageGIFCoder sharedCoder] sd_frameDurationAtIndex:index source:imageSource]; 84 | } else if (CFStringCompare(type, kUTTypePNG, 0) == kCFCompareEqualTo) { 85 | // APNG 86 | frameDuration = [[SDImageAPNGCoder sharedCoder] sd_frameDurationAtIndex:index source:imageSource]; 87 | } 88 | if (!frameDuration) { 89 | return; 90 | } 91 | // Reset super frame duration with the actual frame duration 92 | [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)]; 93 | } 94 | } 95 | 96 | @end 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDAnimatedImageView+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 "SDAnimatedImageView+WebCache.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "UIView+WebCache.h" 14 | #import "SDAnimatedImage.h" 15 | 16 | @implementation SDAnimatedImageView (WebCache) 17 | 18 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 19 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 20 | } 21 | 22 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 23 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 27 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 28 | } 29 | 30 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { 31 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; 32 | } 33 | 34 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 35 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 36 | } 37 | 38 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 39 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 40 | } 41 | 42 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 43 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 44 | } 45 | 46 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { 47 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; 48 | } 49 | 50 | - (void)sd_setImageWithURL:(nullable NSURL *)url 51 | placeholderImage:(nullable UIImage *)placeholder 52 | options:(SDWebImageOptions)options 53 | context:(nullable SDWebImageContext *)context 54 | progress:(nullable SDImageLoaderProgressBlock)progressBlock 55 | completed:(nullable SDExternalCompletionBlock)completedBlock { 56 | Class animatedImageClass = [SDAnimatedImage class]; 57 | SDWebImageMutableContext *mutableContext; 58 | if (context) { 59 | mutableContext = [context mutableCopy]; 60 | } else { 61 | mutableContext = [NSMutableDictionary dictionary]; 62 | } 63 | mutableContext[SDWebImageContextAnimatedImageClass] = animatedImageClass; 64 | [self sd_internalSetImageWithURL:url 65 | placeholderImage:placeholder 66 | options:options 67 | context:mutableContext 68 | setImageBlock:nil 69 | progress:progressBlock 70 | completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { 71 | if (completedBlock) { 72 | completedBlock(image, error, cacheType, imageURL); 73 | } 74 | }]; 75 | } 76 | 77 | @end 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDAnimatedImageView.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 "SDAnimatedImage.h" 14 | 15 | /** 16 | A drop-in replacement for UIImageView/NSImageView, you can use this for animated image rendering. 17 | Call `setImage:` with `UIImage(NSImage)` which conform to `SDAnimatedImage` protocol will start animated image rendering. Call with normal UIImage(NSImage) will back to normal UIImageView(NSImageView) rendering 18 | For UIKit: use `-startAnimating`, `-stopAnimating` to control animating. `isAnimating` to check animation state. 19 | For AppKit: use `-setAnimates:` to control animating, `animates` to check animation state. This view is layer-backed. 20 | */ 21 | @interface SDAnimatedImageView : UIImageView 22 | 23 | /** 24 | Current display frame image. 25 | */ 26 | @property (nonatomic, strong, readonly, nullable) UIImage *currentFrame; 27 | /** 28 | Current frame index, zero based. This value is KVO Compliance. 29 | */ 30 | @property (nonatomic, assign, readonly) NSUInteger currentFrameIndex; 31 | /** 32 | Current loop count since its latest animating. This value is KVO Compliance. 33 | */ 34 | @property (nonatomic, assign, readonly) NSUInteger currentLoopCount; 35 | /** 36 | YES to choose `animationRepeatCount` property for animation loop count. No to use animated image's `animatedImageLoopCount` instead. 37 | Default is NO. 38 | */ 39 | @property (nonatomic, assign) BOOL shouldCustomLoopCount; 40 | /** 41 | Total loop count for animated image rendering. Default is animated image's loop count. 42 | If you need to set custom loop count, set `shouldCustomLoopCount` to YES and change this value. 43 | This class override UIImageView's `animationRepeatCount` property on iOS, use this property as well. 44 | */ 45 | @property (nonatomic, assign) NSInteger animationRepeatCount; 46 | /** 47 | Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0. 48 | `0` means automatically adjust by calculating current memory usage. 49 | `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) 50 | `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory) 51 | */ 52 | @property (nonatomic, assign) NSUInteger maxBufferSize; 53 | /** 54 | Whehter or not to enable incremental image load for animated image. This is for the animated image which `sd_isIncremental` is YES (See `UIImage+Metadata.h`). If enable, animated image rendering will stop at the last frame available currently, and continue when another `setImage:` trigger, where the new animated image's `animatedImageData` should be updated from the previous one. If the `sd_isIncremental` is NO. The incremental image load stop. 55 | @note If you are confused about this description, open Chrome browser to view some large GIF images with low network speed to see the animation behavior. 56 | @note The best practice to use incremental load is using `initWithAnimatedCoder:scale:` in `SDAnimatedImage` with animated coder which conform to `SDProgressiveImageCoder` as well. Then call incremental update and incremental decode method to produce the image. 57 | Default is YES. Set to NO to only render the static poster for incremental animated image. 58 | */ 59 | @property (nonatomic, assign) BOOL shouldIncrementalLoad; 60 | 61 | #if SD_UIKIT 62 | /** 63 | You can specify a runloop mode to let it rendering. 64 | Default is NSRunLoopCommonModes on multi-core iOS device, NSDefaultRunLoopMode on single-core iOS device 65 | */ 66 | @property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode; 67 | #endif 68 | @end 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageAPNGCoder.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 "SDImageCoder.h" 11 | 12 | /** 13 | Built in coder using ImageIO that supports APNG encoding/decoding 14 | */ 15 | @interface SDImageAPNGCoder : NSObject 16 | 17 | @property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /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 | #import "SDMemoryCache.h" 11 | #import "SDDiskCache.h" 12 | 13 | static SDImageCacheConfig *_defaultCacheConfig; 14 | static const NSInteger kDefaultCacheMaxDiskAge = 60 * 60 * 24 * 7; // 1 week 15 | 16 | @implementation SDImageCacheConfig 17 | 18 | + (SDImageCacheConfig *)defaultCacheConfig { 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | _defaultCacheConfig = [SDImageCacheConfig new]; 22 | }); 23 | return _defaultCacheConfig; 24 | } 25 | 26 | - (instancetype)init { 27 | if (self = [super init]) { 28 | _shouldDisableiCloud = YES; 29 | _shouldCacheImagesInMemory = YES; 30 | _shouldUseWeakMemoryCache = YES; 31 | _shouldRemoveExpiredDataWhenEnterBackground = YES; 32 | _diskCacheReadingOptions = 0; 33 | _diskCacheWritingOptions = NSDataWritingAtomic; 34 | _maxDiskAge = kDefaultCacheMaxDiskAge; 35 | _maxDiskSize = 0; 36 | _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate; 37 | _memoryCacheClass = [SDMemoryCache class]; 38 | _diskCacheClass = [SDDiskCache class]; 39 | } 40 | return self; 41 | } 42 | 43 | - (id)copyWithZone:(NSZone *)zone { 44 | SDImageCacheConfig *config = [[[self class] allocWithZone:zone] init]; 45 | config.shouldDisableiCloud = self.shouldDisableiCloud; 46 | config.shouldCacheImagesInMemory = self.shouldCacheImagesInMemory; 47 | config.shouldUseWeakMemoryCache = self.shouldUseWeakMemoryCache; 48 | config.shouldRemoveExpiredDataWhenEnterBackground = self.shouldRemoveExpiredDataWhenEnterBackground; 49 | config.diskCacheReadingOptions = self.diskCacheReadingOptions; 50 | config.diskCacheWritingOptions = self.diskCacheWritingOptions; 51 | config.maxDiskAge = self.maxDiskAge; 52 | config.maxDiskSize = self.maxDiskSize; 53 | config.maxMemoryCost = self.maxMemoryCost; 54 | config.maxMemoryCount = self.maxMemoryCount; 55 | config.diskCacheExpireType = self.diskCacheExpireType; 56 | config.fileManager = self.fileManager; // NSFileManager does not conform to NSCopying, just pass the reference 57 | config.memoryCacheClass = self.memoryCacheClass; 58 | config.diskCacheClass = self.diskCacheClass; 59 | 60 | return config; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCacheDefine.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 "SDImageCacheDefine.h" 10 | #import "SDImageCodersManager.h" 11 | #import "SDImageCoderHelper.h" 12 | #import "SDAnimatedImage.h" 13 | #import "UIImage+Metadata.h" 14 | 15 | UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context) { 16 | UIImage *image; 17 | BOOL decodeFirstFrame = options & SDWebImageDecodeFirstFrameOnly; 18 | NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; 19 | CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); 20 | SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)}; 21 | if (context) { 22 | SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy]; 23 | [mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext]; 24 | coderOptions = [mutableCoderOptions copy]; 25 | } 26 | 27 | if (!decodeFirstFrame) { 28 | Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; 29 | // check whether we should use `SDAnimatedImage` 30 | if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) { 31 | image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions]; 32 | if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) { 33 | [((id)image) preloadAllFrames]; 34 | } 35 | } 36 | } 37 | if (!image) { 38 | image = [[SDImageCodersManager sharedManager] decodedImageWithData:imageData options:coderOptions]; 39 | } 40 | if (image) { 41 | BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0; 42 | if ([image conformsToProtocol:@protocol(SDAnimatedImage)]) { 43 | // `SDAnimatedImage` do not decode 44 | shouldDecode = NO; 45 | } else if (image.sd_isAnimated) { 46 | // animated image do not decode 47 | shouldDecode = NO; 48 | } 49 | if (shouldDecode) { 50 | BOOL shouldScaleDown = options & SDWebImageScaleDownLargeImages; 51 | if (shouldScaleDown) { 52 | image = [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:0]; 53 | } else { 54 | image = [SDImageCoderHelper decodedImageWithImage:image]; 55 | } 56 | } 57 | } 58 | 59 | return image; 60 | } 61 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCachesManager.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 "SDImageCacheDefine.h" 11 | 12 | /// Policy for cache operation 13 | typedef NS_ENUM(NSUInteger, SDImageCachesManagerOperationPolicy) { 14 | SDImageCachesManagerOperationPolicySerial, // process all caches serially (from the highest priority to the lowest priority cache by order) 15 | SDImageCachesManagerOperationPolicyConcurrent, // process all caches concurrently 16 | SDImageCachesManagerOperationPolicyHighestOnly, // process the highest priority cache only 17 | SDImageCachesManagerOperationPolicyLowestOnly // process the lowest priority cache only 18 | }; 19 | 20 | /** 21 | A caches manager to manage multiple caches. 22 | */ 23 | @interface SDImageCachesManager : NSObject 24 | 25 | /** 26 | Returns the global shared caches manager instance. By default we will set [`SDImageCache.sharedImageCache`] into the caches array. 27 | */ 28 | @property (nonatomic, class, readonly, nonnull) SDImageCachesManager *sharedManager; 29 | 30 | // These are op policy for cache manager. 31 | 32 | /** 33 | Operation policy for query op. 34 | Defaults to `Serial`, means query all caches serially (one completion called then next begin) until one cache query success (`image` != nil). 35 | */ 36 | @property (nonatomic, assign) SDImageCachesManagerOperationPolicy queryOperationPolicy; 37 | 38 | /** 39 | Operation policy for store op. 40 | Defaults to `HighestOnly`, means store to the highest priority cache only. 41 | */ 42 | @property (nonatomic, assign) SDImageCachesManagerOperationPolicy storeOperationPolicy; 43 | 44 | /** 45 | Operation policy for remove op. 46 | Defaults to `Concurrent`, means remove all caches concurrently. 47 | */ 48 | @property (nonatomic, assign) SDImageCachesManagerOperationPolicy removeOperationPolicy; 49 | 50 | /** 51 | Operation policy for contains op. 52 | Defaults to `Serial`, means check all caches serially (one completion called then next begin) until one cache check success (`containsCacheType` != None). 53 | */ 54 | @property (nonatomic, assign) SDImageCachesManagerOperationPolicy containsOperationPolicy; 55 | 56 | /** 57 | Operation policy for clear op. 58 | Defaults to `Concurrent`, means clear all caches concurrently. 59 | */ 60 | @property (nonatomic, assign) SDImageCachesManagerOperationPolicy clearOperationPolicy; 61 | 62 | /** 63 | All caches in caches manager. The caches array is a priority queue, which means the later added cache will have the highest priority 64 | */ 65 | @property (nonatomic, copy, nullable) NSArray> *caches; 66 | 67 | /** 68 | Add a new cache to the end of caches array. Which has the highest priority. 69 | 70 | @param cache cache 71 | */ 72 | - (void)addCache:(nonnull id)cache; 73 | 74 | /** 75 | Remove a cache in the caches array. 76 | 77 | @param cache cache 78 | */ 79 | - (void)removeCache:(nonnull id)cache; 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCoder.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 "SDImageCoder.h" 10 | 11 | SDImageCoderOption const SDImageCoderDecodeFirstFrameOnly = @"decodeFirstFrameOnly"; 12 | SDImageCoderOption const SDImageCoderDecodeScaleFactor = @"decodeScaleFactor"; 13 | 14 | SDImageCoderOption const SDImageCoderEncodeFirstFrameOnly = @"encodeFirstFrameOnly"; 15 | SDImageCoderOption const SDImageCoderEncodeCompressionQuality = @"encodeCompressionQuality"; 16 | 17 | SDImageCoderOption const SDImageCoderWebImageContext = @"webImageContext"; 18 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCodersManager.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 "SDImageCoder.h" 11 | 12 | /** 13 | Global object holding the array of coders, so that we avoid passing them from object to object. 14 | Uses a priority queue behind scenes, which means the latest added coders have the highest priority. 15 | This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data. 16 | That way, users can add their custom coders while preserving our existing prebuilt ones 17 | 18 | Note: the `coders` getter will return the coders in their reversed order 19 | Example: 20 | - by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder` 21 | - calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]` 22 | - call `[addCoder:[MyCrazyCoder new]]` 23 | - calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]` 24 | 25 | Coders 26 | ------ 27 | A coder must conform to the `SDImageCoder` protocol or even to `SDProgressiveImageCoder` if it supports progressive decoding 28 | Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat` 29 | Those methods are called on each coder in the array (using the priority order) until one of them returns YES. 30 | That means that coder can decode that data / encode to that format 31 | */ 32 | @interface SDImageCodersManager : NSObject 33 | 34 | /** 35 | Returns the global shared coders manager instance. 36 | */ 37 | @property (nonatomic, class, readonly, nonnull) SDImageCodersManager *sharedManager; 38 | 39 | /** 40 | All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority 41 | */ 42 | @property (nonatomic, copy, nullable) NSArray> *coders; 43 | 44 | /** 45 | Add a new coder to the end of coders array. Which has the highest priority. 46 | 47 | @param coder coder 48 | */ 49 | - (void)addCoder:(nonnull id)coder; 50 | 51 | /** 52 | Remove a coder in the coders array. 53 | 54 | @param coder coder 55 | */ 56 | - (void)removeCoder:(nonnull id)coder; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCodersManager.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 "SDImageCodersManager.h" 10 | #import "SDImageIOCoder.h" 11 | #import "SDImageGIFCoder.h" 12 | #import "SDImageAPNGCoder.h" 13 | #import "SDInternalMacros.h" 14 | 15 | @interface SDImageCodersManager () 16 | 17 | @property (nonatomic, strong, nonnull) dispatch_semaphore_t codersLock; 18 | 19 | @end 20 | 21 | @implementation SDImageCodersManager 22 | { 23 | NSMutableArray> *_imageCoders; 24 | } 25 | 26 | + (nonnull instancetype)sharedManager { 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 | - (instancetype)init { 36 | if (self = [super init]) { 37 | // initialize with default coders 38 | _imageCoders = [NSMutableArray arrayWithArray:@[[SDImageIOCoder sharedCoder], [SDImageGIFCoder sharedCoder], [SDImageAPNGCoder sharedCoder]]]; 39 | _codersLock = dispatch_semaphore_create(1); 40 | } 41 | return self; 42 | } 43 | 44 | - (NSArray> *)coders 45 | { 46 | SD_LOCK(self.codersLock); 47 | NSArray> *coders = [_imageCoders copy]; 48 | SD_UNLOCK(self.codersLock); 49 | return coders; 50 | } 51 | 52 | - (void)setCoders:(NSArray> *)coders 53 | { 54 | SD_LOCK(self.codersLock); 55 | [_imageCoders removeAllObjects]; 56 | if (coders.count) { 57 | [_imageCoders addObjectsFromArray:coders]; 58 | } 59 | SD_UNLOCK(self.codersLock); 60 | } 61 | 62 | #pragma mark - Coder IO operations 63 | 64 | - (void)addCoder:(nonnull id)coder { 65 | if (![coder conformsToProtocol:@protocol(SDImageCoder)]) { 66 | return; 67 | } 68 | SD_LOCK(self.codersLock); 69 | [_imageCoders addObject:coder]; 70 | SD_UNLOCK(self.codersLock); 71 | } 72 | 73 | - (void)removeCoder:(nonnull id)coder { 74 | if (![coder conformsToProtocol:@protocol(SDImageCoder)]) { 75 | return; 76 | } 77 | SD_LOCK(self.codersLock); 78 | [_imageCoders removeObject:coder]; 79 | SD_UNLOCK(self.codersLock); 80 | } 81 | 82 | #pragma mark - SDImageCoder 83 | - (BOOL)canDecodeFromData:(NSData *)data { 84 | NSArray> *coders = self.coders; 85 | for (id coder in coders.reverseObjectEnumerator) { 86 | if ([coder canDecodeFromData:data]) { 87 | return YES; 88 | } 89 | } 90 | return NO; 91 | } 92 | 93 | - (BOOL)canEncodeToFormat:(SDImageFormat)format { 94 | NSArray> *coders = self.coders; 95 | for (id coder in coders.reverseObjectEnumerator) { 96 | if ([coder canEncodeToFormat:format]) { 97 | return YES; 98 | } 99 | } 100 | return NO; 101 | } 102 | 103 | - (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { 104 | if (!data) { 105 | return nil; 106 | } 107 | UIImage *image; 108 | NSArray> *coders = self.coders; 109 | for (id coder in coders.reverseObjectEnumerator) { 110 | if ([coder canDecodeFromData:data]) { 111 | image = [coder decodedImageWithData:data options:options]; 112 | break; 113 | } 114 | } 115 | 116 | return image; 117 | } 118 | 119 | - (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { 120 | if (!image) { 121 | return nil; 122 | } 123 | NSArray> *coders = self.coders; 124 | for (id coder in coders.reverseObjectEnumerator) { 125 | if ([coder canEncodeToFormat:format]) { 126 | return [coder encodedDataWithImage:image format:format options:options]; 127 | } 128 | } 129 | return nil; 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageFrame.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 | /** 13 | This class is used for creating animated images via `animatedImageWithFrames` in `SDImageCoderHelper`. 14 | @note If you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+Metadata.h`. 15 | */ 16 | @interface SDImageFrame : NSObject 17 | 18 | /** 19 | The image of current frame. You should not set an animated image. 20 | */ 21 | @property (nonatomic, strong, readonly, nonnull) UIImage *image; 22 | /** 23 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero. 24 | */ 25 | @property (nonatomic, readonly, assign) NSTimeInterval duration; 26 | 27 | /** 28 | Create a frame instance with specify image and duration 29 | 30 | @param image current frame's image 31 | @param duration current frame's duration 32 | @return frame instance 33 | */ 34 | + (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageFrame.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 "SDImageFrame.h" 10 | 11 | @interface SDImageFrame () 12 | 13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image; 14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration; 15 | 16 | @end 17 | 18 | @implementation SDImageFrame 19 | 20 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration { 21 | SDImageFrame *frame = [[SDImageFrame alloc] init]; 22 | frame.image = image; 23 | frame.duration = duration; 24 | 25 | return frame; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageGIFCoder.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 "SDImageCoder.h" 11 | 12 | /** 13 | Built in coder using ImageIO that supports animated GIF encoding/decoding 14 | @note `SDImageIOCoder` supports GIF but only as static (will use the 1st frame). 15 | @note Use `SDImageGIFCoder` for fully animated GIFs. For `UIImageView`, it will produce animated `UIImage`(`NSImage` on macOS) for rendering. For `SDAnimatedImageView`, it will use `SDAnimatedImage` for rendering. 16 | @note The recommended approach for animated GIFs is using `SDAnimatedImage` with `SDAnimatedImageView`. It's more performant than `UIImageView` for GIF displaying(especially on memory usage) 17 | */ 18 | @interface SDImageGIFCoder : NSObject 19 | 20 | @property (nonatomic, class, readonly, nonnull) SDImageGIFCoder *sharedCoder; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageGraphics.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 11 | 12 | /** 13 | These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code. 14 | For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage. 15 | For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit. 16 | */ 17 | 18 | /// Returns the current graphics context. 19 | FOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED; 20 | /// Creates a bitmap-based graphics context and makes it the current context. 21 | FOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size); 22 | /// Creates a bitmap-based graphics context with the specified options. 23 | FOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); 24 | /// Removes the current bitmap-based graphics context from the top of the stack. 25 | FOUNDATION_EXPORT void SDGraphicsEndImageContext(void); 26 | /// Returns an image based on the contents of the current bitmap-based graphics context. 27 | FOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void); 28 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageGraphics.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 "SDImageGraphics.h" 10 | #import "NSImage+Compatibility.h" 11 | #import "objc/runtime.h" 12 | 13 | #if SD_MAC 14 | static void *kNSGraphicsContextScaleFactorKey; 15 | 16 | static CGContextRef SDCGContextCreateBitmapContext(CGSize size, BOOL opaque, CGFloat scale) { 17 | if (scale == 0) { 18 | // Match `UIGraphicsBeginImageContextWithOptions`, reset to the scale factor of the device’s main screen if scale is 0. 19 | scale = [NSScreen mainScreen].backingScaleFactor; 20 | } 21 | size_t width = ceil(size.width * scale); 22 | size_t height = ceil(size.height * scale); 23 | if (width < 1 || height < 1) return NULL; 24 | 25 | //pre-multiplied BGRA for non-opaque, BGRX for opaque, 8-bits per component, as Apple's doc 26 | CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); 27 | CGImageAlphaInfo alphaInfo = kCGBitmapByteOrder32Host | (opaque ? kCGImageAlphaNoneSkipFirst : kCGImageAlphaPremultipliedFirst); 28 | CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, space, kCGBitmapByteOrderDefault | alphaInfo); 29 | CGColorSpaceRelease(space); 30 | if (!context) { 31 | return NULL; 32 | } 33 | CGContextScaleCTM(context, scale, scale); 34 | 35 | return context; 36 | } 37 | #endif 38 | 39 | CGContextRef SDGraphicsGetCurrentContext(void) { 40 | #if SD_UIKIT || SD_WATCH 41 | return UIGraphicsGetCurrentContext(); 42 | #else 43 | return NSGraphicsContext.currentContext.CGContext; 44 | #endif 45 | } 46 | 47 | void SDGraphicsBeginImageContext(CGSize size) { 48 | #if SD_UIKIT || SD_WATCH 49 | UIGraphicsBeginImageContext(size); 50 | #else 51 | SDGraphicsBeginImageContextWithOptions(size, NO, 1.0); 52 | #endif 53 | } 54 | 55 | void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { 56 | #if SD_UIKIT || SD_WATCH 57 | UIGraphicsBeginImageContextWithOptions(size, opaque, scale); 58 | #else 59 | CGContextRef context = SDCGContextCreateBitmapContext(size, opaque, scale); 60 | if (!context) { 61 | return; 62 | } 63 | NSGraphicsContext *graphicsContext = [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO]; 64 | objc_setAssociatedObject(graphicsContext, &kNSGraphicsContextScaleFactorKey, @(scale), OBJC_ASSOCIATION_RETAIN); 65 | CGContextRelease(context); 66 | [NSGraphicsContext saveGraphicsState]; 67 | NSGraphicsContext.currentContext = graphicsContext; 68 | #endif 69 | } 70 | 71 | void SDGraphicsEndImageContext(void) { 72 | #if SD_UIKIT || SD_WATCH 73 | UIGraphicsEndImageContext(); 74 | #else 75 | [NSGraphicsContext restoreGraphicsState]; 76 | #endif 77 | } 78 | 79 | UIImage * SDGraphicsGetImageFromCurrentImageContext(void) { 80 | #if SD_UIKIT || SD_WATCH 81 | return UIGraphicsGetImageFromCurrentImageContext(); 82 | #else 83 | NSGraphicsContext *context = NSGraphicsContext.currentContext; 84 | CGContextRef contextRef = context.CGContext; 85 | if (!contextRef) { 86 | return nil; 87 | } 88 | CGImageRef imageRef = CGBitmapContextCreateImage(contextRef); 89 | if (!imageRef) { 90 | return nil; 91 | } 92 | CGFloat scale = 0; 93 | NSNumber *scaleFactor = objc_getAssociatedObject(context, &kNSGraphicsContextScaleFactorKey); 94 | if ([scaleFactor isKindOfClass:[NSNumber class]]) { 95 | scale = scaleFactor.doubleValue; 96 | } 97 | if (!scale) { 98 | // reset to the scale factor of the device’s main screen if scale is 0. 99 | scale = [NSScreen mainScreen].backingScaleFactor; 100 | } 101 | NSImage *image = [[NSImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp]; 102 | CGImageRelease(imageRef); 103 | return image; 104 | #endif 105 | } 106 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageIOCoder.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 "SDImageCoder.h" 11 | 12 | /** 13 | Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding. 14 | 15 | GIF 16 | Also supports static GIF (meaning will only handle the 1st frame). 17 | For a full GIF support, we recommend `SDAnimatedImageView` to keep both CPU and memory balanced. 18 | 19 | HEIC 20 | This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf 21 | Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13) 22 | Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU)) 23 | Encode(Software): macOS 10.13 24 | Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU)) 25 | */ 26 | @interface SDImageIOCoder : NSObject 27 | 28 | @property (nonatomic, class, readonly, nonnull) SDImageIOCoder *sharedCoder; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageLoadersManager.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 "SDImageLoader.h" 10 | 11 | /** 12 | A loaders manager to manage multiple loaders 13 | */ 14 | @interface SDImageLoadersManager : NSObject 15 | 16 | /** 17 | Returns the global shared loaders manager instance. By default we will set [`SDWebImageDownloader.sharedDownloader`] into the loaders array. 18 | */ 19 | @property (nonatomic, class, readonly, nonnull) SDImageLoadersManager *sharedManager; 20 | 21 | /** 22 | All image loaders in manager. The loaders array is a priority queue, which means the later added loader will have the highest priority 23 | */ 24 | @property (nonatomic, copy, nullable) NSArray>* loaders; 25 | 26 | /** 27 | Add a new image loader to the end of loaders array. Which has the highest priority. 28 | 29 | @param loader loader 30 | */ 31 | - (void)addLoader:(nonnull id)loader; 32 | 33 | /** 34 | Remove a image loader in the loaders array. 35 | 36 | @param loader loader 37 | */ 38 | - (void)removeLoader:(nonnull id)loader; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageLoadersManager.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 "SDImageLoadersManager.h" 10 | #import "SDWebImageDownloader.h" 11 | #import "SDInternalMacros.h" 12 | 13 | @interface SDImageLoadersManager () 14 | 15 | @property (nonatomic, strong, nonnull) dispatch_semaphore_t loadersLock; 16 | 17 | @end 18 | 19 | @implementation SDImageLoadersManager 20 | { 21 | NSMutableArray>* _imageLoaders; 22 | } 23 | 24 | + (SDImageLoadersManager *)sharedManager { 25 | static dispatch_once_t onceToken; 26 | static SDImageLoadersManager *manager; 27 | dispatch_once(&onceToken, ^{ 28 | manager = [[SDImageLoadersManager alloc] init]; 29 | }); 30 | return manager; 31 | } 32 | 33 | - (instancetype)init { 34 | self = [super init]; 35 | if (self) { 36 | // initialize with default image loaders 37 | _imageLoaders = [NSMutableArray arrayWithObject:[SDWebImageDownloader sharedDownloader]]; 38 | _loadersLock = dispatch_semaphore_create(1); 39 | } 40 | return self; 41 | } 42 | 43 | - (NSArray> *)loaders { 44 | SD_LOCK(self.loadersLock); 45 | NSArray>* loaders = [_imageLoaders copy]; 46 | SD_UNLOCK(self.loadersLock); 47 | return loaders; 48 | } 49 | 50 | - (void)setLoaders:(NSArray> *)loaders { 51 | SD_LOCK(self.loadersLock); 52 | [_imageLoaders removeAllObjects]; 53 | if (loaders.count) { 54 | [_imageLoaders addObjectsFromArray:loaders]; 55 | } 56 | SD_UNLOCK(self.loadersLock); 57 | } 58 | 59 | #pragma mark - Loader Property 60 | 61 | - (void)addLoader:(id)loader { 62 | if (![loader conformsToProtocol:@protocol(SDImageLoader)]) { 63 | return; 64 | } 65 | SD_LOCK(self.loadersLock); 66 | [_imageLoaders addObject:loader]; 67 | SD_UNLOCK(self.loadersLock); 68 | } 69 | 70 | - (void)removeLoader:(id)loader { 71 | if (![loader conformsToProtocol:@protocol(SDImageLoader)]) { 72 | return; 73 | } 74 | SD_LOCK(self.loadersLock); 75 | [_imageLoaders removeObject:loader]; 76 | SD_UNLOCK(self.loadersLock); 77 | } 78 | 79 | #pragma mark - SDImageLoader 80 | 81 | - (BOOL)canRequestImageForURL:(nullable NSURL *)url { 82 | NSArray> *loaders = self.loaders; 83 | for (id loader in loaders.reverseObjectEnumerator) { 84 | if ([loader canRequestImageForURL:url]) { 85 | return YES; 86 | } 87 | } 88 | return NO; 89 | } 90 | 91 | - (id)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock { 92 | if (!url) { 93 | return nil; 94 | } 95 | NSArray> *loaders = self.loaders; 96 | for (id loader in loaders.reverseObjectEnumerator) { 97 | if ([loader canRequestImageForURL:url]) { 98 | return [loader requestImageWithURL:url options:options context:context progress:progressBlock completed:completedBlock]; 99 | } 100 | } 101 | return nil; 102 | } 103 | 104 | - (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error { 105 | NSArray> *loaders = self.loaders; 106 | for (id loader in loaders.reverseObjectEnumerator) { 107 | if ([loader canRequestImageForURL:url]) { 108 | return [loader shouldBlockFailedURLWithURL:url error:error]; 109 | } 110 | } 111 | return NO; 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDMemoryCache.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 | @class SDImageCacheConfig; 12 | /** 13 | A protocol to allow custom memory cache used in SDImageCache. 14 | */ 15 | @protocol SDMemoryCache 16 | 17 | @required 18 | /** 19 | Create a new memory cache instance with the specify cache config. You can check `maxMemoryCost` and `maxMemoryCount` used for memory cache. 20 | 21 | @param config The cache config to be used to create the cache. 22 | @return The new memory cache instance. 23 | */ 24 | - (nonnull instancetype)initWithConfig:(nonnull SDImageCacheConfig *)config; 25 | 26 | /** 27 | Returns the value associated with a given key. 28 | 29 | @param key An object identifying the value. If nil, just return nil. 30 | @return The value associated with key, or nil if no value is associated with key. 31 | */ 32 | - (nullable id)objectForKey:(nonnull id)key; 33 | 34 | /** 35 | Sets the value of the specified key in the cache (0 cost). 36 | 37 | @param object The object to be stored in the cache. If nil, it calls `removeObjectForKey:`. 38 | @param key The key with which to associate the value. If nil, this method has no effect. 39 | @discussion Unlike an NSMutableDictionary object, a cache does not copy the key 40 | objects that are put into it. 41 | */ 42 | - (void)setObject:(nullable id)object forKey:(nonnull id)key; 43 | 44 | /** 45 | Sets the value of the specified key in the cache, and associates the key-value 46 | pair with the specified cost. 47 | 48 | @param object The object to store in the cache. If nil, it calls `removeObjectForKey`. 49 | @param key The key with which to associate the value. If nil, this method has no effect. 50 | @param cost The cost with which to associate the key-value pair. 51 | @discussion Unlike an NSMutableDictionary object, a cache does not copy the key 52 | objects that are put into it. 53 | */ 54 | - (void)setObject:(nullable id)object forKey:(nonnull id)key cost:(NSUInteger)cost; 55 | 56 | /** 57 | Removes the value of the specified key in the cache. 58 | 59 | @param key The key identifying the value to be removed. If nil, this method has no effect. 60 | */ 61 | - (void)removeObjectForKey:(nonnull id)key; 62 | 63 | /** 64 | Empties the cache immediately. 65 | */ 66 | - (void)removeAllObjects; 67 | 68 | @end 69 | 70 | /** 71 | A memory cache which auto purge the cache on memory warning and support weak cache. 72 | */ 73 | @interface SDMemoryCache : NSCache 74 | 75 | @property (nonatomic, strong, nonnull, readonly) SDImageCacheConfig *config; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCacheKeyFilter.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 | typedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url); 13 | 14 | /** 15 | This is the protocol for cache key filter. 16 | We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. 17 | */ 18 | @protocol SDWebImageCacheKeyFilter 19 | 20 | - (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url; 21 | 22 | @end 23 | 24 | /** 25 | A cache key filter class with block. 26 | */ 27 | @interface SDWebImageCacheKeyFilter : NSObject 28 | 29 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; 30 | + (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCacheKeyFilter.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 "SDWebImageCacheKeyFilter.h" 10 | 11 | @interface SDWebImageCacheKeyFilter () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageCacheKeyFilterBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageCacheKeyFilter 18 | 19 | - (instancetype)initWithBlock:(SDWebImageCacheKeyFilterBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)cacheKeyFilterWithBlock:(SDWebImageCacheKeyFilterBlock)block { 28 | SDWebImageCacheKeyFilter *cacheKeyFilter = [[SDWebImageCacheKeyFilter alloc] initWithBlock:block]; 29 | return cacheKeyFilter; 30 | } 31 | 32 | - (NSString *)cacheKeyForURL:(NSURL *)url { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(url); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCacheSerializer.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 | typedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL); 13 | 14 | /** 15 | This is the protocol for cache serializer. 16 | We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. 17 | */ 18 | @protocol SDWebImageCacheSerializer 19 | 20 | - (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL; 21 | 22 | @end 23 | 24 | /** 25 | A cache serializer class with block. 26 | */ 27 | @interface SDWebImageCacheSerializer : NSObject 28 | 29 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; 30 | + (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCacheSerializer.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 "SDWebImageCacheSerializer.h" 10 | 11 | @interface SDWebImageCacheSerializer () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageCacheSerializerBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageCacheSerializer 18 | 19 | - (instancetype)initWithBlock:(SDWebImageCacheSerializerBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)cacheSerializerWithBlock:(SDWebImageCacheSerializerBlock)block { 28 | SDWebImageCacheSerializer *cacheSerializer = [[SDWebImageCacheSerializer alloc] initWithBlock:block]; 29 | return cacheSerializer; 30 | } 31 | 32 | - (NSData *)cacheDataWithImage:(UIImage *)image originalData:(NSData *)data imageURL:(nullable NSURL *)imageURL { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(image, data, imageURL); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /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 | // Seems like TARGET_OS_MAC is always defined (on all platforms). 17 | // To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8 18 | #if TARGET_OS_OSX 19 | #define SD_MAC 1 20 | #else 21 | #define SD_MAC 0 22 | #endif 23 | 24 | // iOS and tvOS are very similar, UIKit exists on both platforms 25 | // Note: watchOS also has UIKit, but it's very limited 26 | #if TARGET_OS_IOS || TARGET_OS_TV 27 | #define SD_UIKIT 1 28 | #else 29 | #define SD_UIKIT 0 30 | #endif 31 | 32 | #if TARGET_OS_IOS 33 | #define SD_IOS 1 34 | #else 35 | #define SD_IOS 0 36 | #endif 37 | 38 | #if TARGET_OS_TV 39 | #define SD_TV 1 40 | #else 41 | #define SD_TV 0 42 | #endif 43 | 44 | #if TARGET_OS_WATCH 45 | #define SD_WATCH 1 46 | #else 47 | #define SD_WATCH 0 48 | #endif 49 | 50 | 51 | #if SD_MAC 52 | #import 53 | #ifndef UIImage 54 | #define UIImage NSImage 55 | #endif 56 | #ifndef UIImageView 57 | #define UIImageView NSImageView 58 | #endif 59 | #ifndef UIView 60 | #define UIView NSView 61 | #endif 62 | #ifndef UIColor 63 | #define UIColor NSColor 64 | #endif 65 | #else 66 | #if SD_UIKIT 67 | #import 68 | #endif 69 | #if SD_WATCH 70 | #import 71 | #ifndef UIView 72 | #define UIView WKInterfaceObject 73 | #endif 74 | #ifndef UIImageView 75 | #define UIImageView WKInterfaceImage 76 | #endif 77 | #endif 78 | #endif 79 | 80 | #ifndef NS_ENUM 81 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 82 | #endif 83 | 84 | #ifndef NS_OPTIONS 85 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 86 | #endif 87 | 88 | #ifndef dispatch_main_async_safe 89 | #define dispatch_main_async_safe(block)\ 90 | if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ 91 | block();\ 92 | } else {\ 93 | dispatch_async(dispatch_get_main_queue(), block);\ 94 | } 95 | #endif 96 | -------------------------------------------------------------------------------- /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 | #if !__has_feature(objc_arc) 12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 13 | #endif 14 | 15 | #if !OS_OBJECT_USE_OBJC 16 | #error SDWebImage need ARC for dispatch object 17 | #endif 18 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloaderConfig.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 | /// Operation execution order 13 | typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { 14 | /** 15 | * Default value. All download operations will execute in queue style (first-in-first-out). 16 | */ 17 | SDWebImageDownloaderFIFOExecutionOrder, 18 | 19 | /** 20 | * All download operations will execute in stack style (last-in-first-out). 21 | */ 22 | SDWebImageDownloaderLIFOExecutionOrder 23 | }; 24 | 25 | /** 26 | The class contains all the config for image downloader 27 | @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well. 28 | */ 29 | @interface SDWebImageDownloaderConfig : NSObject 30 | 31 | /** 32 | Gets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`. 33 | @note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected. 34 | */ 35 | @property (nonatomic, class, readonly, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig; 36 | 37 | /** 38 | * The maximum number of concurrent downloads. 39 | * Defaults to 6. 40 | */ 41 | @property (nonatomic, assign) NSInteger maxConcurrentDownloads; 42 | 43 | /** 44 | * The timeout value (in seconds) for each download operation. 45 | * Defaults to 15.0. 46 | */ 47 | @property (nonatomic, assign) NSTimeInterval downloadTimeout; 48 | 49 | /** 50 | * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected. 51 | * The value should be 0.0-1.0. 52 | * @note If you're using progressive decoding feature, this will also effect the image refresh rate. 53 | * @note This value may enhance the performance if you don't want progress callback too frequently. 54 | * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately. 55 | */ 56 | @property (nonatomic, assign) double minimumProgressInterval; 57 | 58 | /** 59 | * The custom session configuration in use by NSURLSession. If you don't provide one, we will use `defaultSessionConfiguration` instead. 60 | * Defatuls to nil. 61 | * @note This property does not support dynamic changes, means it's immutable after the downloader instance initialized. 62 | */ 63 | @property (nonatomic, strong, nullable) NSURLSessionConfiguration *sessionConfiguration; 64 | 65 | /** 66 | * Gets/Sets a subclass of `SDWebImageDownloaderOperation` as the default 67 | * `NSOperation` to be used each time SDWebImage constructs a request 68 | * operation to download an image. 69 | * Defaults to nil. 70 | * @note Passing `NSOperation` to set as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. 71 | */ 72 | @property (nonatomic, assign, nullable) Class operationClass; 73 | 74 | /** 75 | * Changes download operations execution order. 76 | * Defaults to `SDWebImageDownloaderFIFOExecutionOrder`. 77 | */ 78 | @property (nonatomic, assign) SDWebImageDownloaderExecutionOrder executionOrder; 79 | 80 | /** 81 | * Set the default URL credential to be set for request operations. 82 | * Defaults to nil. 83 | */ 84 | @property (nonatomic, copy, nullable) NSURLCredential *urlCredential; 85 | 86 | /** 87 | * Set username using for HTTP Basic authentication. 88 | * Defaults to nil. 89 | */ 90 | @property (nonatomic, copy, nullable) NSString *username; 91 | 92 | /** 93 | * Set password using for HTTP Basic authentication. 94 | * Defautls to nil. 95 | */ 96 | @property (nonatomic, copy, nullable) NSString *password; 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloaderConfig.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 "SDWebImageDownloaderConfig.h" 10 | 11 | static SDWebImageDownloaderConfig * _defaultDownloaderConfig; 12 | 13 | @implementation SDWebImageDownloaderConfig 14 | 15 | + (SDWebImageDownloaderConfig *)defaultDownloaderConfig { 16 | static dispatch_once_t onceToken; 17 | dispatch_once(&onceToken, ^{ 18 | _defaultDownloaderConfig = [SDWebImageDownloaderConfig new]; 19 | }); 20 | return _defaultDownloaderConfig; 21 | } 22 | 23 | - (instancetype)init { 24 | self = [super init]; 25 | if (self) { 26 | _maxConcurrentDownloads = 6; 27 | _downloadTimeout = 15.0; 28 | _executionOrder = SDWebImageDownloaderFIFOExecutionOrder; 29 | } 30 | return self; 31 | } 32 | 33 | - (id)copyWithZone:(NSZone *)zone { 34 | SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init]; 35 | config.maxConcurrentDownloads = self.maxConcurrentDownloads; 36 | config.downloadTimeout = self.downloadTimeout; 37 | config.minimumProgressInterval = self.minimumProgressInterval; 38 | config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone]; 39 | config.operationClass = self.operationClass; 40 | config.executionOrder = self.executionOrder; 41 | config.urlCredential = self.urlCredential; 42 | config.username = self.username; 43 | config.password = self.password; 44 | 45 | return config; 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloaderRequestModifier.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 | typedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSURLRequest * _Nonnull request); 13 | 14 | /** 15 | This is the protocol for downloader request modifier. 16 | We can use a block to specify the downloader request modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. 17 | */ 18 | @protocol SDWebImageDownloaderRequestModifier 19 | 20 | - (nullable NSURLRequest *)modifiedRequestWithRequest:(nonnull NSURLRequest *)request; 21 | 22 | @end 23 | 24 | /** 25 | A downloader request modifier class with block. 26 | */ 27 | @interface SDWebImageDownloaderRequestModifier : NSObject 28 | 29 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; 30 | + (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloaderRequestModifier.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 "SDWebImageDownloaderRequestModifier.h" 10 | 11 | @interface SDWebImageDownloaderRequestModifier () 12 | 13 | @property (nonatomic, copy, nonnull) SDWebImageDownloaderRequestModifierBlock block; 14 | 15 | @end 16 | 17 | @implementation SDWebImageDownloaderRequestModifier 18 | 19 | - (instancetype)initWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { 20 | self = [super init]; 21 | if (self) { 22 | self.block = block; 23 | } 24 | return self; 25 | } 26 | 27 | + (instancetype)requestModifierWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { 28 | SDWebImageDownloaderRequestModifier *requestModifier = [[SDWebImageDownloaderRequestModifier alloc] initWithBlock:block]; 29 | return requestModifier; 30 | } 31 | 32 | - (NSURLRequest *)modifiedRequestWithRequest:(NSURLRequest *)request { 33 | if (!self.block) { 34 | return nil; 35 | } 36 | return self.block(request); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageError.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 "SDWebImageCompat.h" 11 | 12 | FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain; 13 | 14 | /// The HTTP status code for invalid download response (NSNumber *) 15 | FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey; 16 | 17 | /// SDWebImage error domain and codes 18 | typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) { 19 | SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL 20 | SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty 21 | SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached` 22 | SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized 23 | SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image downloda response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey` 24 | }; 25 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageError.m: -------------------------------------------------------------------------------- 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 "SDWebImageError.h" 11 | 12 | NSErrorDomain const _Nonnull SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 13 | NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey = @"SDWebImageErrorDownloadStatusCodeKey"; 14 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageIndicator.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 | /** 14 | A protocol to custom the indicator during the image loading. 15 | All of these methods are called from main queue. 16 | */ 17 | @protocol SDWebImageIndicator 18 | 19 | @required 20 | /** 21 | The view associate to the indicator. 22 | 23 | @return The indicator view 24 | */ 25 | @property (nonatomic, strong, readonly, nonnull) UIView *indicatorView; 26 | 27 | /** 28 | Start the animating for indicator. 29 | */ 30 | - (void)startAnimatingIndicator; 31 | 32 | /** 33 | Stop the animating for indicator. 34 | */ 35 | - (void)stopAnimatingIndicator; 36 | 37 | @optional 38 | /** 39 | Update the loading progress (0-1.0) for indicator. Optional 40 | 41 | @param progress The progress, value between 0 and 1.0 42 | */ 43 | - (void)updateIndicatorProgress:(double)progress; 44 | 45 | @end 46 | 47 | #pragma mark - Activity Indicator 48 | 49 | /** 50 | Activity indicator class. 51 | for UIKit(macOS), it use a `UIActivityIndicatorView`. 52 | for AppKit(macOS), it use a `NSProgressIndicator` with the spinning style. 53 | */ 54 | @interface SDWebImageActivityIndicator : NSObject 55 | 56 | #if SD_UIKIT 57 | @property (nonatomic, strong, readonly, nonnull) UIActivityIndicatorView *indicatorView; 58 | #else 59 | @property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView; 60 | #endif 61 | 62 | @end 63 | 64 | /** 65 | Convenience way to use activity indicator. 66 | */ 67 | @interface SDWebImageActivityIndicator (Conveniences) 68 | 69 | /// gray-style activity indicator 70 | @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayIndicator; 71 | /// large gray-style activity indicator 72 | @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayLargeIndicator; 73 | /// white-style activity indicator 74 | @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteIndicator; 75 | /// large white-style activity indicator 76 | @property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteLargeIndicator; 77 | 78 | @end 79 | 80 | #pragma mark - Progress Indicator 81 | 82 | /** 83 | Progress indicator class. 84 | for UIKit(macOS), it use a `UIProgressView`. 85 | for AppKit(macOS), it use a `NSProgressIndicator` with the bar style. 86 | */ 87 | @interface SDWebImageProgressIndicator : NSObject 88 | 89 | #if SD_UIKIT 90 | @property (nonatomic, strong, readonly, nonnull) UIProgressView *indicatorView; 91 | #else 92 | @property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView; 93 | #endif 94 | 95 | @end 96 | 97 | /** 98 | Convenience way to create progress indicator. Remember to specify the indicator width or use layout constraint if need. 99 | */ 100 | @interface SDWebImageProgressIndicator (Conveniences) 101 | 102 | /// default-style progress indicator 103 | @property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator; 104 | /// bar-style progress indicator 105 | @property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(macos, tvos); 106 | 107 | @end 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /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 | /// A protocol represents cancelable operation. 12 | @protocol SDWebImageOperation 13 | 14 | - (void)cancel; 15 | 16 | @end 17 | 18 | /// NSOperation conform to `SDWebImageOperation`. 19 | @interface NSOperation (SDWebImageOperation) 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.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 | /** 12 | UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior). 13 | */ 14 | @interface UIImage (ForceDecode) 15 | 16 | /** 17 | A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode. 18 | */ 19 | @property (nonatomic, assign) BOOL sd_isDecoded; 20 | 21 | /** 22 | Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance. 23 | 24 | @param image The image to be decoded 25 | @return The decoded image 26 | */ 27 | + (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image; 28 | 29 | /** 30 | Decode and scale down the provided image 31 | 32 | @param image The image to be decoded 33 | @return The decoded and scaled down image 34 | */ 35 | + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 36 | 37 | /** 38 | Decode and scale down the provided image with limit bytes 39 | 40 | @param image The image to be decoded 41 | @param bytes The limit bytes size. Provide 0 to use the build-in limit. 42 | @return The decoded and scaled down image 43 | */ 44 | + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.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+ForceDecode.h" 10 | #import "SDImageCoderHelper.h" 11 | #import "objc/runtime.h" 12 | 13 | @implementation UIImage (ForceDecode) 14 | 15 | - (BOOL)sd_isDecoded { 16 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isDecoded)); 17 | return value.boolValue; 18 | } 19 | 20 | - (void)setSd_isDecoded:(BOOL)sd_isDecoded { 21 | objc_setAssociatedObject(self, @selector(sd_isDecoded), @(sd_isDecoded), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 22 | } 23 | 24 | + (UIImage *)sd_decodedImageWithImage:(UIImage *)image { 25 | if (!image) { 26 | return nil; 27 | } 28 | return [SDImageCoderHelper decodedImageWithImage:image]; 29 | } 30 | 31 | + (UIImage *)sd_decodedAndScaledDownImageWithImage:(UIImage *)image { 32 | return [self sd_decodedAndScaledDownImageWithImage:image limitBytes:0]; 33 | } 34 | 35 | + (UIImage *)sd_decodedAndScaledDownImageWithImage:(UIImage *)image limitBytes:(NSUInteger)bytes { 36 | if (!image) { 37 | return nil; 38 | } 39 | return [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /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 | /** 13 | This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder`. 14 | */ 15 | @interface UIImage (GIF) 16 | 17 | /** 18 | Creates an animated UIImage from an NSData. 19 | This will create animated image if the data is Animated GIF. And will create a static image is the data is Static GIF. 20 | 21 | @param data The GIF data 22 | @return The created image 23 | */ 24 | + (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /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 "SDImageGIFCoder.h" 12 | 13 | @implementation UIImage (GIF) 14 | 15 | + (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data { 16 | if (!data) { 17 | return nil; 18 | } 19 | return [[SDImageGIFCoder sharedCoder] decodedImageWithData:data options:0]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MemoryCacheCost.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 | /** 12 | UIImage category for memory cache cost. 13 | */ 14 | @interface UIImage (MemoryCacheCost) 15 | 16 | /** 17 | The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory. 18 | If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost. 19 | 20 | For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Retuen full frame bytes size when `image.images` is not nil for animated image. 21 | For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory. 22 | @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods. 23 | @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes. 24 | */ 25 | @property (assign, nonatomic) NSUInteger sd_memoryCost; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MemoryCacheCost.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+MemoryCacheCost.h" 10 | #import "objc/runtime.h" 11 | #import "NSImage+Compatibility.h" 12 | 13 | FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) { 14 | CGImageRef imageRef = image.CGImage; 15 | if (!imageRef) { 16 | return 0; 17 | } 18 | NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); 19 | NSUInteger frameCount; 20 | #if SD_MAC 21 | frameCount = 1; 22 | #elif SD_UIKIT || SD_WATCH 23 | frameCount = image.images.count > 0 ? image.images.count : 1; 24 | #endif 25 | NSUInteger cost = bytesPerFrame * frameCount; 26 | return cost; 27 | } 28 | 29 | @implementation UIImage (MemoryCacheCost) 30 | 31 | - (NSUInteger)sd_memoryCost { 32 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost)); 33 | NSUInteger memoryCost; 34 | if (value != nil) { 35 | memoryCost = [value unsignedIntegerValue]; 36 | } else { 37 | memoryCost = SDMemoryCacheCostForImage(self); 38 | } 39 | return memoryCost; 40 | } 41 | 42 | - (void)setSd_memoryCost:(NSUInteger)sd_memoryCost { 43 | objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+Metadata.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 | /** 13 | UIImage category for image metadata, including animation, loop count, format, incremental, etc. 14 | */ 15 | @interface UIImage (Metadata) 16 | 17 | /** 18 | * UIKit: 19 | * For static image format, this value is always 0. 20 | * For animated image format, 0 means infinite looping. 21 | * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. 22 | * AppKit: 23 | * NSImage currently only support animated via GIF imageRep unlike UIImage. 24 | * The getter of this property will get the loop count from GIF imageRep 25 | * The setter of this property will set the loop count from GIF imageRep 26 | */ 27 | @property (nonatomic, assign) NSUInteger sd_imageLoopCount; 28 | 29 | /** 30 | * UIKit: 31 | * Check the `images` array property 32 | * AppKit: 33 | * NSImage currently only support animated via GIF imageRep unlike UIImage. It will check the imageRep's frame count. 34 | */ 35 | @property (nonatomic, assign, readonly) BOOL sd_isAnimated; 36 | 37 | /** 38 | * The image format represent the original compressed image data format. 39 | * If you don't manually specify a format, this information is retrieve from CGImage using `CGImageGetUTType`, which may return nil for non-CG based image. At this time it will return `SDImageFormatUndefined` as default value. 40 | * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. 41 | */ 42 | @property (nonatomic, assign) SDImageFormat sd_imageFormat; 43 | 44 | /** 45 | A bool value indicating whether the image is during incremental decoding and may not contains full pixels. 46 | */ 47 | @property (nonatomic, assign) BOOL sd_isIncremental; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+Metadata.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+Metadata.h" 10 | #import "NSImage+Compatibility.h" 11 | #import "objc/runtime.h" 12 | 13 | @implementation UIImage (Metadata) 14 | 15 | #if SD_UIKIT || SD_WATCH 16 | 17 | - (NSUInteger)sd_imageLoopCount { 18 | NSUInteger imageLoopCount = 0; 19 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount)); 20 | if ([value isKindOfClass:[NSNumber class]]) { 21 | imageLoopCount = value.unsignedIntegerValue; 22 | } 23 | return imageLoopCount; 24 | } 25 | 26 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { 27 | NSNumber *value = @(sd_imageLoopCount); 28 | objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 29 | } 30 | 31 | - (BOOL)sd_isAnimated { 32 | return (self.images != nil); 33 | } 34 | 35 | #else 36 | 37 | - (NSUInteger)sd_imageLoopCount { 38 | NSUInteger imageLoopCount = 0; 39 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 40 | NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; 41 | NSBitmapImageRep *bitmapImageRep; 42 | if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { 43 | bitmapImageRep = (NSBitmapImageRep *)imageRep; 44 | } 45 | if (bitmapImageRep) { 46 | imageLoopCount = [[bitmapImageRep valueForProperty:NSImageLoopCount] unsignedIntegerValue]; 47 | } 48 | return imageLoopCount; 49 | } 50 | 51 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { 52 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 53 | NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; 54 | NSBitmapImageRep *bitmapImageRep; 55 | if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { 56 | bitmapImageRep = (NSBitmapImageRep *)imageRep; 57 | } 58 | if (bitmapImageRep) { 59 | [bitmapImageRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)]; 60 | } 61 | } 62 | 63 | - (BOOL)sd_isAnimated { 64 | BOOL isGIF = NO; 65 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 66 | NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; 67 | NSBitmapImageRep *bitmapImageRep; 68 | if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { 69 | bitmapImageRep = (NSBitmapImageRep *)imageRep; 70 | } 71 | if (bitmapImageRep) { 72 | NSUInteger frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; 73 | isGIF = frameCount > 1 ? YES : NO; 74 | } 75 | return isGIF; 76 | } 77 | 78 | #endif 79 | 80 | - (SDImageFormat)sd_imageFormat { 81 | SDImageFormat imageFormat = SDImageFormatUndefined; 82 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFormat)); 83 | if ([value isKindOfClass:[NSNumber class]]) { 84 | imageFormat = value.integerValue; 85 | return imageFormat; 86 | } 87 | // Check CGImage's UTType, may return nil for non-Image/IO based image 88 | if (@available(iOS 9.0, tvOS 9.0, macOS 10.11, watchOS 2.0, *)) { 89 | CFStringRef uttype = CGImageGetUTType(self.CGImage); 90 | imageFormat = [NSData sd_imageFormatFromUTType:uttype]; 91 | } 92 | return imageFormat; 93 | } 94 | 95 | - (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat { 96 | objc_setAssociatedObject(self, @selector(sd_imageFormat), @(sd_imageFormat), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 97 | } 98 | 99 | - (void)setSd_isIncremental:(BOOL)sd_isIncremental { 100 | objc_setAssociatedObject(self, @selector(sd_isIncremental), @(sd_isIncremental), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 101 | } 102 | 103 | - (BOOL)sd_isIncremental { 104 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isIncremental)); 105 | return value.boolValue; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /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 | /** 13 | UIImage category for convenient image format decoding/encoding. 14 | */ 15 | @interface UIImage (MultiFormat) 16 | #pragma mark - Decode 17 | /** 18 | Create and decode a image with the specify image data 19 | 20 | @param data The image data 21 | @return The created image 22 | */ 23 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 24 | 25 | /** 26 | Create and decode a image with the specify image data and scale 27 | 28 | @param data The image data 29 | @param scale The image scale factor. Should be greater than or equal to 1.0. 30 | @return The created image 31 | */ 32 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale; 33 | 34 | /** 35 | Create and decode a image with the specify image data and scale, allow specify animate/static control 36 | 37 | @param data The image data 38 | @param scale The image scale factor. Should be greater than or equal to 1.0. 39 | @param firstFrameOnly Even if the image data is animated image format, decode the first frame only as static image. 40 | @return The created image 41 | */ 42 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly; 43 | 44 | #pragma mark - Encode 45 | /** 46 | Encode the current image to the data, the image format is unspecified 47 | 48 | @return The encoded data. If can't encode, return nil 49 | */ 50 | - (nullable NSData *)sd_imageData; 51 | 52 | /** 53 | Encode the current image to data with the specify image format 54 | 55 | @param imageFormat The specify image format 56 | @return The encoded data. If can't encode, return nil 57 | */ 58 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat NS_SWIFT_NAME(sd_imageData(as:)); 59 | 60 | /** 61 | Encode the current image to data with the specify image format and compression quality 62 | 63 | @param imageFormat The specify image format 64 | @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality. 65 | @return The encoded data. If can't encode, return nil 66 | */ 67 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality NS_SWIFT_NAME(sd_imageData(as:compressionQuality:)); 68 | 69 | /** 70 | Encode the current image to data with the specify image format and compression quality, allow specify animate/static control 71 | 72 | @param imageFormat The specify image format 73 | @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality. 74 | @param firstFrameOnly Even if the image is animated image, encode the first frame only as static image. 75 | @return The encoded data. If can't encode, return nil 76 | */ 77 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly NS_SWIFT_NAME(sd_imageData(as:compressionQuality:firstFrameOnly:)); 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /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 "SDImageCodersManager.h" 11 | 12 | @implementation UIImage (MultiFormat) 13 | 14 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { 15 | return [self sd_imageWithData:data scale:1]; 16 | } 17 | 18 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale { 19 | return [self sd_imageWithData:data scale:scale firstFrameOnly:NO]; 20 | } 21 | 22 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly { 23 | if (!data) { 24 | return nil; 25 | } 26 | SDImageCoderOptions *options = @{SDImageCoderDecodeScaleFactor : @(MAX(scale, 1)), SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}; 27 | return [[SDImageCodersManager sharedManager] decodedImageWithData:data options:options]; 28 | } 29 | 30 | - (nullable NSData *)sd_imageData { 31 | return [self sd_imageDataAsFormat:SDImageFormatUndefined]; 32 | } 33 | 34 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { 35 | return [self sd_imageDataAsFormat:imageFormat compressionQuality:1]; 36 | } 37 | 38 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality { 39 | return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO]; 40 | } 41 | 42 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly { 43 | SDImageCoderOptions *options = @{SDImageCoderEncodeCompressionQuality : @(compressionQuality), SDImageCoderEncodeFirstFrameOnly : @(firstFrameOnly)}; 44 | return [[SDImageCodersManager sharedManager] encodedDataWithImage:self format:imageFormat options:options]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /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 | #import "SDInternalMacros.h" 16 | 17 | static NSString * const SDHighlightedImageOperationKey = @"UIImageViewImageOperationHighlighted"; 18 | 19 | @implementation UIImageView (HighlightedWebCache) 20 | 21 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { 22 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 23 | } 24 | 25 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { 26 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 27 | } 28 | 29 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { 30 | [self sd_setHighlightedImageWithURL:url options:options context:context progress:nil completed:nil]; 31 | } 32 | 33 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 34 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 35 | } 36 | 37 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 38 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 39 | } 40 | 41 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { 42 | [self sd_setHighlightedImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; 43 | } 44 | 45 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 46 | options:(SDWebImageOptions)options 47 | context:(nullable SDWebImageContext *)context 48 | progress:(nullable SDImageLoaderProgressBlock)progressBlock 49 | completed:(nullable SDExternalCompletionBlock)completedBlock { 50 | @weakify(self); 51 | SDWebImageMutableContext *mutableContext; 52 | if (context) { 53 | mutableContext = [context mutableCopy]; 54 | } else { 55 | mutableContext = [NSMutableDictionary dictionary]; 56 | } 57 | mutableContext[SDWebImageContextSetImageOperationKey] = SDHighlightedImageOperationKey; 58 | [self sd_internalSetImageWithURL:url 59 | placeholderImage:nil 60 | options:options 61 | context:mutableContext 62 | setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { 63 | @strongify(self); 64 | self.highlightedImage = image; 65 | } 66 | progress:progressBlock 67 | completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { 68 | if (completedBlock) { 69 | completedBlock(image, error, cacheType, imageURL); 70 | } 71 | }]; 72 | } 73 | 74 | @end 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /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 | #import "objc/runtime.h" 11 | #import "UIView+WebCacheOperation.h" 12 | #import "UIView+WebCache.h" 13 | 14 | @implementation UIImageView (WebCache) 15 | 16 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 17 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 18 | } 19 | 20 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 21 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 22 | } 23 | 24 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 25 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 26 | } 27 | 28 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { 29 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; 30 | } 31 | 32 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 33 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 34 | } 35 | 36 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 37 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 38 | } 39 | 40 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 41 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 42 | } 43 | 44 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { 45 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; 46 | } 47 | 48 | - (void)sd_setImageWithURL:(nullable NSURL *)url 49 | placeholderImage:(nullable UIImage *)placeholder 50 | options:(SDWebImageOptions)options 51 | context:(nullable SDWebImageContext *)context 52 | progress:(nullable SDImageLoaderProgressBlock)progressBlock 53 | completed:(nullable SDExternalCompletionBlock)completedBlock { 54 | [self sd_internalSetImageWithURL:url 55 | placeholderImage:placeholder 56 | options:options 57 | context:context 58 | setImageBlock:nil 59 | progress:progressBlock 60 | completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { 61 | if (completedBlock) { 62 | completedBlock(image, error, cacheType, imageURL); 63 | } 64 | }]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /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 | #import "SDWebImageOperation.h" 11 | 12 | /** 13 | These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external. 14 | All the stored operations are weak, so it will be dalloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them. 15 | */ 16 | @interface UIView (WebCacheOperation) 17 | 18 | /** 19 | * Get the image load operation for key 20 | * 21 | * @param key key for identifying the operations 22 | * @return the image load operation 23 | */ 24 | - (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key; 25 | 26 | /** 27 | * Set the image load operation (storage in a UIView based weak map table) 28 | * 29 | * @param operation the operation 30 | * @param key key for storing the operation 31 | */ 32 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 33 | 34 | /** 35 | * Cancel all operations for the current UIView and key 36 | * 37 | * @param key key for identifying the operations 38 | */ 39 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 40 | 41 | /** 42 | * Just remove the operations corresponding to the current UIView and key without cancelling them 43 | * 44 | * @param key key for identifying the operations 45 | */ 46 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /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 | #import "objc/runtime.h" 11 | 12 | static char loadOperationKey; 13 | 14 | // key is strong, value is weak because operation instance is retained by SDWebImageManager's runningOperations property 15 | // we should use lock to keep thread-safe because these method may not be acessed from main queue 16 | typedef NSMapTable> SDOperationsDictionary; 17 | 18 | @implementation UIView (WebCacheOperation) 19 | 20 | - (SDOperationsDictionary *)sd_operationDictionary { 21 | @synchronized(self) { 22 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 23 | if (operations) { 24 | return operations; 25 | } 26 | operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0]; 27 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return operations; 29 | } 30 | } 31 | 32 | - (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key { 33 | id operation; 34 | if (key) { 35 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 36 | @synchronized (self) { 37 | operation = [operationDictionary objectForKey:key]; 38 | } 39 | } 40 | return operation; 41 | } 42 | 43 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { 44 | if (key) { 45 | [self sd_cancelImageLoadOperationWithKey:key]; 46 | if (operation) { 47 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 48 | @synchronized (self) { 49 | [operationDictionary setObject:operation forKey:key]; 50 | } 51 | } 52 | } 53 | } 54 | 55 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { 56 | if (key) { 57 | // Cancel in progress downloader from queue 58 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 59 | id operation; 60 | 61 | @synchronized (self) { 62 | operation = [operationDictionary objectForKey:key]; 63 | } 64 | if (operation) { 65 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { 66 | [operation cancel]; 67 | } 68 | @synchronized (self) { 69 | [operationDictionary removeObjectForKey:key]; 70 | } 71 | } 72 | } 73 | } 74 | 75 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { 76 | if (key) { 77 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 78 | @synchronized (self) { 79 | [operationDictionary removeObjectForKey:key]; 80 | } 81 | } 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Pods/SDWebImage/WebImage/SDWebImage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Florent Vilmart 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 | #if SD_UIKIT 13 | #import 14 | #endif 15 | 16 | //! Project version number for WebImage. 17 | FOUNDATION_EXPORT double WebImageVersionNumber; 18 | 19 | //! Project version string for WebImage. 20 | FOUNDATION_EXPORT const unsigned char WebImageVersionString[]; 21 | 22 | // In this header, you should import all the public headers of your framework using statements like #import 23 | 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | #import 54 | #import 55 | #import 56 | #import 57 | #import 58 | #import 59 | #import 60 | #import 61 | #import 62 | #import 63 | #import 64 | #import 65 | #import 66 | #import 67 | #import 68 | #import 69 | 70 | // Mac 71 | #if __has_include() 72 | #import 73 | #endif 74 | #if __has_include() 75 | #import 76 | #endif 77 | #if __has_include() 78 | #import 79 | #endif 80 | 81 | // MapKit 82 | #if __has_include() 83 | #import 84 | #endif 85 | -------------------------------------------------------------------------------- /Pods/SDWebImage/WebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/JSONModel/JSONModel-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.8.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/JSONModel/JSONModel-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_JSONModel : NSObject 3 | @end 4 | @implementation PodsDummy_JSONModel 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/JSONModel/JSONModel-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 | -------------------------------------------------------------------------------- /Pods/Target Support Files/JSONModel/JSONModel-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 "JSONModel.h" 14 | #import "JSONModelClassProperty.h" 15 | #import "JSONModelError.h" 16 | #import "JSONModelLib.h" 17 | #import "JSONAPI.h" 18 | #import "JSONHTTPClient.h" 19 | #import "JSONModel+networking.h" 20 | #import "JSONKeyMapper.h" 21 | #import "JSONValueTransformer.h" 22 | 23 | FOUNDATION_EXPORT double JSONModelVersionNumber; 24 | FOUNDATION_EXPORT const unsigned char JSONModelVersionString[]; 25 | 26 | -------------------------------------------------------------------------------- /Pods/Target Support Files/JSONModel/JSONModel.modulemap: -------------------------------------------------------------------------------- 1 | framework module JSONModel { 2 | umbrella header "JSONModel-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/JSONModel/JSONModel.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/JSONModel 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/JSONModel 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-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/Pods-Stories/Pods-Stories-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## JSONModel 5 | 6 | Copyright (c) 2012-2016 Marin Todorov and JSONModel contributors 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | this software and associated documentation files (the "Software"), to deal in 10 | the Software without restriction, including without limitation the rights to 11 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | the Software, and to permit persons to whom the Software is furnished to do so, 13 | 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, FITNESS 20 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | 26 | ## SDWebImage 27 | 28 | Copyright (c) 2009-2018 Olivier Poitrey rs@dailymotion.com 29 | 30 | Permission is hereby granted, free of charge, to any person obtaining a copy 31 | of this software and associated documentation files (the "Software"), to deal 32 | in the Software without restriction, including without limitation the rights 33 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 34 | copies of the Software, and to permit persons to whom the Software is furnished 35 | to do so, subject to the following conditions: 36 | 37 | The above copyright notice and this permission notice shall be included in all 38 | copies or substantial portions of the Software. 39 | 40 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 44 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 45 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 46 | THE SOFTWARE. 47 | 48 | 49 | Generated by CocoaPods - https://cocoapods.org 50 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-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) 2012-2016 Marin Todorov and JSONModel contributors 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of 20 | this software and associated documentation files (the "Software"), to deal in 21 | the Software without restriction, including without limitation the rights to 22 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 23 | the Software, and to permit persons to whom the Software is furnished to do so, 24 | 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, FITNESS 31 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 32 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 33 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 34 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 | 36 | License 37 | MIT 38 | Title 39 | JSONModel 40 | Type 41 | PSGroupSpecifier 42 | 43 | 44 | FooterText 45 | Copyright (c) 2009-2018 Olivier Poitrey rs@dailymotion.com 46 | 47 | Permission is hereby granted, free of charge, to any person obtaining a copy 48 | of this software and associated documentation files (the "Software"), to deal 49 | in the Software without restriction, including without limitation the rights 50 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 51 | copies of the Software, and to permit persons to whom the Software is furnished 52 | to do so, subject to the following conditions: 53 | 54 | The above copyright notice and this permission notice shall be included in all 55 | copies or substantial portions of the Software. 56 | 57 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 58 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 59 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 60 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 61 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 62 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 63 | THE SOFTWARE. 64 | 65 | 66 | License 67 | MIT 68 | Title 69 | SDWebImage 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Generated by CocoaPods - https://cocoapods.org 76 | Title 77 | 78 | Type 79 | PSGroupSpecifier 80 | 81 | 82 | StringsTable 83 | Acknowledgements 84 | Title 85 | Acknowledgements 86 | 87 | 88 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Stories : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Stories 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-Stories/Pods-Stories-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/JSONModel/JSONModel.framework 3 | ${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSONModel.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-Stories/Pods-Stories-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/JSONModel/JSONModel.framework 3 | ${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSONModel.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories-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_StoriesVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_StoriesVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/JSONModel" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/JSONModel/JSONModel.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "ImageIO" -framework "JSONModel" -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-Stories/Pods-Stories.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Stories { 2 | umbrella header "Pods-Stories-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Stories/Pods-Stories.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/JSONModel" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/JSONModel/JSONModel.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "ImageIO" -framework "JSONModel" -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/SDWebImage/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 | 5.0.6 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 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 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "ImageIO" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | It is similar like Instagram Stories, to show video or photo directly of the users account. This is the Objective C implementation of https://github.com/antonyraphel/ARStories 2 | 3 | Please remember to run `pod install` to install necessary pods and open the `Stories.xcworkspace` in Xcode to run the project. -------------------------------------------------------------------------------- /Stories.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Stories.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Stories.xcodeproj/xcuserdata/maksumon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Stories.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Stories.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Stories.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Stories.xcworkspace/xcuserdata/maksumon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Stories/ARStories/ContentViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentViewController.swift 3 | // ARStories 4 | // 5 | // Created by Antony Raphel on 05/10/17. 6 | // 7 | 8 | import UIKit 9 | 10 | var ContentViewControllerVC = ContentViewController() 11 | 12 | @objc class ContentViewController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate { 13 | 14 | var pageViewController : UIPageViewController? 15 | @objc var pages: [UserDetail] = [] 16 | @objc var currentIndex : Int = 0 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | // Do any additional setup after loading the view. 22 | ContentViewControllerVC = self 23 | pageViewController = storyboard?.instantiateViewController(withIdentifier: "PageViewController") as? UIPageViewController 24 | pageViewController!.dataSource = self 25 | pageViewController!.delegate = self 26 | 27 | let startingViewController: PreViewController = viewControllerAtIndex(index: currentIndex)! 28 | let viewControllers = [startingViewController] 29 | pageViewController!.setViewControllers(viewControllers , direction: .forward, animated: false, completion: nil) 30 | pageViewController!.view.frame = view.bounds 31 | 32 | addChild(pageViewController!) 33 | view.addSubview(pageViewController!.view) 34 | view.sendSubviewToBack(pageViewController!.view) 35 | pageViewController!.didMove(toParent: self) 36 | } 37 | 38 | override func didReceiveMemoryWarning() { 39 | super.didReceiveMemoryWarning() 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | override var prefersStatusBarHidden: Bool { 44 | return true 45 | } 46 | 47 | // MARK: - UIPageViewControllerDataSource 48 | //1 49 | func pageViewController(_ pageViewController: UIPageViewController, 50 | viewControllerBefore viewController: UIViewController) -> UIViewController? 51 | { 52 | var index = (viewController as! PreViewController).pageIndex 53 | if (index == 0) || (index == NSNotFound) { 54 | return nil 55 | } 56 | index -= 1 57 | return viewControllerAtIndex(index: index) 58 | } 59 | 60 | //2 61 | func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { 62 | var index = (viewController as! PreViewController).pageIndex 63 | if index == NSNotFound { 64 | return nil 65 | } 66 | index += 1 67 | if (index == pages.count) { 68 | return nil 69 | } 70 | return viewControllerAtIndex(index: index) 71 | } 72 | 73 | //3 74 | func viewControllerAtIndex(index: Int) -> PreViewController? { 75 | if pages.count == 0 || index >= pages.count { 76 | return nil 77 | } 78 | 79 | // Create a new view controller and pass suitable data. 80 | let vc = storyboard?.instantiateViewController(withIdentifier: "PreView") as! PreViewController 81 | vc.pageIndex = index 82 | vc.items = pages 83 | currentIndex = index 84 | 85 | vc.view.transform = CGAffineTransform(scaleX: 1.4, y: 1.4) 86 | return vc 87 | } 88 | 89 | // Navigate to next page 90 | func goNextPage(fowardTo position: Int) { 91 | let startingViewController: PreViewController = viewControllerAtIndex(index: position)! 92 | let viewControllers = [startingViewController] 93 | pageViewController!.setViewControllers(viewControllers , direction: .forward, animated: true, completion: nil) 94 | } 95 | 96 | // MARK: - Button Actions 97 | @IBAction func closeAction(_ sender: Any) { 98 | dismiss(animated: true, completion: nil) 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Stories/ARStories/Extension/ARSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ARSupport.swift 3 | // ARStories 4 | // 5 | // Created by ANTONY RAPHEL on 04/09/18. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | class ImageLoader: UIImageView { 12 | public func loadImageWith(from urlString: String, completion: @escaping (Bool, UIImage) -> ()) { 13 | guard let url = URL(string: urlString) else { return } 14 | URLSession.shared.dataTask(with: url) { data, response, error in 15 | guard let data = data, error == nil else { 16 | completion(false, UIImage()) 17 | return 18 | } 19 | DispatchQueue.main.async { 20 | if let imageToCache = UIImage(data: data) { 21 | completion(true, imageToCache) 22 | } else { 23 | completion(false, UIImage()) 24 | } 25 | } 26 | }.resume() 27 | } 28 | } 29 | 30 | extension UIImageView { 31 | func imageFromServerURL(_ URLString: String) { 32 | self.image = nil 33 | if let url = URL(string: URLString) { 34 | URLSession.shared.dataTask(with: url, completionHandler: { (data, response, error) in 35 | if error != nil { 36 | print("ERROR LOADING IMAGES FROM URL: \(String(describing: error))") 37 | return 38 | } 39 | DispatchQueue.main.async { 40 | if let data = data { 41 | if let downloadedImage = UIImage(data: data) { 42 | self.image = downloadedImage 43 | } 44 | } 45 | } 46 | }).resume() 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Stories/ARStories/Helper/usersCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // usersCollectionViewCell.swift 3 | // ARStories 4 | // 5 | // Created by Antony Raphel on 05/10/17. 6 | // 7 | 8 | import UIKit 9 | 10 | class usersCollectionViewCell: UICollectionViewCell { 11 | @IBOutlet weak var imgView: UIImageView! 12 | @IBOutlet weak var lblUserName: UILabel! 13 | 14 | override func awakeFromNib() { 15 | super.awakeFromNib() 16 | // Initialization code 17 | self.lblUserName.textAlignment = .center 18 | self.imgView.layer.cornerRadius = self.imgView.frame.size.height / 2; 19 | self.imgView.layer.borderColor = UIColor.red.cgColor 20 | self.imgView.layer.borderWidth = 3 21 | self.imgView.clipsToBounds = true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Stories/ARStories/Model/Content.h: -------------------------------------------------------------------------------- 1 | // 2 | // Content.h 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 10/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol Content @end 12 | 13 | @interface Content : JSONModel 14 | 15 | @property (nonatomic) NSString *type; 16 | @property (nonatomic) NSString *url; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Stories/ARStories/Model/Content.m: -------------------------------------------------------------------------------- 1 | // 2 | // Content.m 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 10/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import "Content.h" 10 | 11 | @implementation Content 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Stories/ARStories/Model/UserDetail.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserDetail.h 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 10/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Content.h" 11 | 12 | @interface UserDetail : JSONModel 13 | 14 | @property (nonatomic) NSString *name; 15 | @property (nonatomic) NSString *imageUrl; 16 | @property (nonatomic) NSArray *contents; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Stories/ARStories/Model/UserDetail.m: -------------------------------------------------------------------------------- 1 | // 2 | // UserDetail.m 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 10/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import "UserDetail.h" 10 | 11 | @implementation UserDetail 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Stories/ARStories/Model/UserDetailCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserDetailCell.h 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 10/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UserDetailCell : UICollectionViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UIImageView *imgView; 14 | @property (weak, nonatomic) IBOutlet UILabel *lblUserName; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Stories/ARStories/Model/UserDetailCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // UserDetailCell.m 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 10/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import "UserDetailCell.h" 10 | 11 | @implementation UserDetailCell 12 | 13 | -(void)awakeFromNib { 14 | [super awakeFromNib]; 15 | 16 | self.imgView.layer.cornerRadius = self.imgView.frame.size.height / 2; 17 | self.imgView.layer.borderColor = [UIColor redColor].CGColor; 18 | self.imgView.layer.borderWidth = 3; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Stories/ARStories/Stories-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | #import "UserDetail.h" 5 | #import "Content.h" 6 | -------------------------------------------------------------------------------- /Stories/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 09/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Stories/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 09/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // 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. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Stories/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 | } -------------------------------------------------------------------------------- /Stories/Assets.xcassets/Close.imageset/Close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maksumon/Stories/80d961dc8faaa6e1c9251d2e3145a4b49e0390db/Stories/Assets.xcassets/Close.imageset/Close@2x.png -------------------------------------------------------------------------------- /Stories/Assets.xcassets/Close.imageset/Close@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maksumon/Stories/80d961dc8faaa6e1c9251d2e3145a4b49e0390db/Stories/Assets.xcassets/Close.imageset/Close@3x.png -------------------------------------------------------------------------------- /Stories/Assets.xcassets/Close.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Close@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "Close@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Stories/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Stories/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 | -------------------------------------------------------------------------------- /Stories/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 | -------------------------------------------------------------------------------- /Stories/Resource/user-details.json: -------------------------------------------------------------------------------- 1 | { 2 | "userDetails": [ 3 | { 4 | "name": "Sabine", 5 | "imageUrl": "https://randomuser.me/api/portraits/men/82.jpg", 6 | "contents": [ 7 | { 8 | "type": "video", 9 | "url": "https://storage.googleapis.com/coverr-main/mp4/Travaho.mp4" 10 | }, 11 | { 12 | "type": "image", 13 | "url": "https://picsum.photos/640/1136/?image=281" 14 | }, 15 | { 16 | "type": "image", 17 | "url": "https://picsum.photos/640/1136/?image=282" 18 | }, 19 | { 20 | "type": "video", 21 | "url": "https://storage.googleapis.com/coverr-main/mp4/Beach.mp4" 22 | }, 23 | { 24 | "type": "image", 25 | "url": "https://picsum.photos/640/1136/?image=272" 26 | } 27 | ] 28 | }, 29 | { 30 | "name": "Keila Maney", 31 | "imageUrl": "https://randomuser.me/api/portraits/women/81.jpg", 32 | "contents": [ 33 | { 34 | "type": "image", 35 | "url": "https://picsum.photos/640/1136/?image=273" 36 | }, 37 | { 38 | "type": "video", 39 | "url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4" 40 | } 41 | ] 42 | }, 43 | { 44 | "name": "Gilberto", 45 | "imageUrl": "https://randomuser.me/api/portraits/men/36.jpg", 46 | "contents": [ 47 | { 48 | "type": "video", 49 | "url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4" 50 | }, 51 | { 52 | "type": "image", 53 | "url": "https://picsum.photos/640/1136/?image=277" 54 | }, 55 | { 56 | "type": "video", 57 | "url": "https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_5mb.mp4" 58 | } 59 | ] 60 | }, 61 | { 62 | "name": "Jonathan", 63 | "imageUrl": "https://randomuser.me/api/portraits/men/75.jpg", 64 | "contents": [ 65 | { 66 | "type": "image", 67 | "url": "https://picsum.photos/640/1136/?image=278" 68 | }, 69 | { 70 | "type": "video", 71 | "url": "https://storage.googleapis.com/coverr-main/mp4/It_s%20show%20time.mp4" 72 | }, 73 | { 74 | "type": "video", 75 | "url": "https://storage.googleapis.com/coverr-main/mp4/Verticastle.mp4" 76 | } 77 | ] 78 | }, 79 | { 80 | "name": "Carolyne", 81 | "imageUrl": "https://randomuser.me/api/portraits/women/50.jpg", 82 | "contents": [ 83 | { 84 | "type": "image", 85 | "url": "https://picsum.photos/640/1136/?image=279" 86 | }, 87 | { 88 | "type": "image", 89 | "url": "https://picsum.photos/640/1136/?image=280" 90 | }, 91 | { 92 | "type": "video", 93 | "url": "https://storage.googleapis.com/coverr-main/webm/ShowT.webm" 94 | } 95 | ] 96 | } 97 | ] 98 | } 99 | -------------------------------------------------------------------------------- /Stories/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 09/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (weak, nonatomic) IBOutlet UICollectionView *usersCollectionView; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /Stories/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 09/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "UserDetail.h" 11 | #import "UserDetailCell.h" 12 | #import 13 | #import "Stories-Swift.h" 14 | 15 | @interface ViewController () { 16 | NSMutableArray *arrayDetails; 17 | } 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view. 26 | [self fetchUserData]; 27 | } 28 | 29 | - (void)fetchUserData { 30 | NSString *path = [NSBundle.mainBundle pathForResource:@"user-details" ofType:@"json"]; 31 | NSData *data = [NSData dataWithContentsOfFile:path]; 32 | 33 | @try { 34 | NSError* error; 35 | NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; 36 | 37 | NSArray *userDetails = [json objectForKey:@"userDetails"]; 38 | 39 | arrayDetails = [NSMutableArray new]; 40 | 41 | for (int i = 0; i < userDetails.count; i++) { 42 | UserDetail *userDetail = [[UserDetail alloc] initWithDictionary:[userDetails objectAtIndex:i] error:nil]; 43 | [arrayDetails addObject:userDetail]; 44 | } 45 | 46 | NSLog(@"User Details: %@", arrayDetails); 47 | 48 | [self.usersCollectionView reloadData]; 49 | } @catch (NSException *exception) { 50 | NSLog(@"Failed to load: %@", exception.description); 51 | } 52 | } 53 | 54 | #pragma mark UICollectionViewDataSourcec 55 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 56 | return arrayDetails.count; 57 | } 58 | 59 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 60 | UserDetailCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; 61 | 62 | UserDetail *userDetail = [arrayDetails objectAtIndex:indexPath.item]; 63 | 64 | cell.lblUserName.text = userDetail.name; 65 | [cell.imgView sd_setImageWithURL:[NSURL URLWithString:userDetail.imageUrl]]; 66 | 67 | return cell; 68 | } 69 | 70 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { 71 | ContentViewController *contentVC = [self.storyboard instantiateViewControllerWithIdentifier:@"ContentView"]; 72 | contentVC.modalPresentationStyle = UIModalPresentationOverFullScreen; 73 | contentVC.pages = arrayDetails; 74 | contentVC.currentIndex = indexPath.item; 75 | 76 | [self presentViewController:contentVC animated:YES completion:nil]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Stories/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Stories 4 | // 5 | // Created by Mohammad Ashraful Kabir on 09/08/2019. 6 | // Copyright © 2019 Mohammad Ashraful Kabir. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | --------------------------------------------------------------------------------