├── .gitattributes ├── .gitignore ├── Podfile ├── Podfile.lock ├── Pods ├── MBProgressHUD │ ├── LICENSE │ ├── MBProgressHUD.h │ ├── MBProgressHUD.m │ └── README.mdown ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj ├── SDWebImage │ ├── LICENSE │ ├── README.md │ └── SDWebImage │ │ ├── NSButton+WebCache.h │ │ ├── NSButton+WebCache.m │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── NSImage+WebCache.h │ │ ├── NSImage+WebCache.m │ │ ├── SDAnimatedImageRep.h │ │ ├── SDAnimatedImageRep.m │ │ ├── SDImageCache.h │ │ ├── SDImageCache.m │ │ ├── SDImageCacheConfig.h │ │ ├── SDImageCacheConfig.m │ │ ├── SDWebImageCoder.h │ │ ├── SDWebImageCoder.m │ │ ├── SDWebImageCoderHelper.h │ │ ├── SDWebImageCoderHelper.m │ │ ├── SDWebImageCodersManager.h │ │ ├── SDWebImageCodersManager.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloader.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageDownloaderOperation.m │ │ ├── SDWebImageFrame.h │ │ ├── SDWebImageFrame.m │ │ ├── SDWebImageGIFCoder.h │ │ ├── SDWebImageGIFCoder.m │ │ ├── SDWebImageImageIOCoder.h │ │ ├── SDWebImageImageIOCoder.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+MultiFormat.h │ │ ├── UIImage+MultiFormat.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 ├── SnapKit │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── Constraint.swift │ │ ├── ConstraintAttributes.swift │ │ ├── ConstraintConfig.swift │ │ ├── ConstraintConstantTarget.swift │ │ ├── ConstraintDSL.swift │ │ ├── ConstraintDescription.swift │ │ ├── ConstraintInsetTarget.swift │ │ ├── ConstraintInsets.swift │ │ ├── ConstraintItem.swift │ │ ├── ConstraintLayoutGuide+Extensions.swift │ │ ├── ConstraintLayoutGuide.swift │ │ ├── ConstraintLayoutGuideDSL.swift │ │ ├── ConstraintLayoutSupport.swift │ │ ├── ConstraintLayoutSupportDSL.swift │ │ ├── ConstraintMaker.swift │ │ ├── ConstraintMakerEditable.swift │ │ ├── ConstraintMakerExtendable.swift │ │ ├── ConstraintMakerFinalizable.swift │ │ ├── ConstraintMakerPriortizable.swift │ │ ├── ConstraintMakerRelatable.swift │ │ ├── ConstraintMultiplierTarget.swift │ │ ├── ConstraintOffsetTarget.swift │ │ ├── ConstraintPriority.swift │ │ ├── ConstraintPriorityTarget.swift │ │ ├── ConstraintRelatableTarget.swift │ │ ├── ConstraintRelation.swift │ │ ├── ConstraintView+Extensions.swift │ │ ├── ConstraintView.swift │ │ ├── ConstraintViewDSL.swift │ │ ├── Debugging.swift │ │ ├── LayoutConstraint.swift │ │ ├── LayoutConstraintItem.swift │ │ ├── Typealiases.swift │ │ └── UILayoutSupport+Extensions.swift └── Target Support Files │ ├── MBProgressHUD │ ├── MBProgressHUD-Info.plist │ ├── MBProgressHUD-dummy.m │ ├── MBProgressHUD-prefix.pch │ ├── MBProgressHUD-umbrella.h │ ├── MBProgressHUD.modulemap │ └── MBProgressHUD.xcconfig │ ├── Pods-RichTextDemo │ ├── Pods-RichTextDemo-Info.plist │ ├── Pods-RichTextDemo-acknowledgements.markdown │ ├── Pods-RichTextDemo-acknowledgements.plist │ ├── Pods-RichTextDemo-dummy.m │ ├── Pods-RichTextDemo-frameworks.sh │ ├── Pods-RichTextDemo-umbrella.h │ ├── Pods-RichTextDemo.debug.xcconfig │ ├── Pods-RichTextDemo.modulemap │ └── Pods-RichTextDemo.release.xcconfig │ ├── SDWebImage │ ├── SDWebImage-Info.plist │ ├── SDWebImage-dummy.m │ ├── SDWebImage-prefix.pch │ ├── SDWebImage-umbrella.h │ ├── SDWebImage.modulemap │ └── SDWebImage.xcconfig │ └── SnapKit │ ├── SnapKit-Info.plist │ ├── SnapKit-dummy.m │ ├── SnapKit-prefix.pch │ ├── SnapKit-umbrella.h │ ├── SnapKit.modulemap │ └── SnapKit.xcconfig ├── README.md ├── RichTextDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── RichTextDemo.xcworkspace └── contents.xcworkspacedata └── RichTextDemo ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json ├── circle_icon_thumbup_default.imageset │ ├── Contents.json │ ├── circle_icon_thumbup_default.png │ ├── circle_icon_thumbup_default@2x.png │ └── circle_icon_thumbup_default@3x.png ├── circle_icon_thumbup_select.imageset │ ├── Contents.json │ ├── circle_icon_thumbup_elect.png │ ├── circle_icon_thumbup_elect@2x.png │ └── circle_icon_thumbup_elect@3x.png └── defaultavatar.imageset │ ├── Contents.json │ ├── icon-morentouxiang@2x.png │ └── icon-morentouxiang@3x.png ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── GKPhotoBrowser ├── GKLoadingView │ ├── GKLoadingView.h │ └── GKLoadingView.m ├── GKPhoto.h ├── GKPhoto.m ├── GKPhotoBrowser.bundle │ ├── angle-mask.png │ ├── angle-mask@2x.png │ └── angle-mask@3x.png ├── GKPhotoBrowser.h ├── GKPhotoBrowser.m ├── GKPhotoBrowserConfigure.h ├── GKPhotoView.h ├── GKPhotoView.m ├── GKScrollView.h ├── GKScrollView.m ├── GKWebImageManager.h ├── GKWebImageManager.m ├── GKWebImageProtocol.h ├── UIImage+GKDecoder.h ├── UIImage+GKDecoder.m ├── UIScrollView+GKGestureHandle.h └── UIScrollView+GKGestureHandle.m ├── HXQButton.swift ├── HXQLabel.swift ├── HXQView.swift ├── Info.plist ├── LoadingView.swift ├── MBProgressHUD+FastKit.swift ├── MBProgressHUD.bundle ├── error.png ├── error@2x.png ├── error@3x.png ├── success.png ├── success@2x.png └── success@3x.png ├── RichTextDemo1VC.swift ├── RichTextDemo2VC.swift ├── RichTextDemo3VC.swift ├── RichTextHeaderView.swift ├── RichTextView.swift ├── Swift-Bridge-Objective-C.h ├── UIImage+FastKit.swift ├── UIView+FastKit.swift └── ViewController.swift /.gitattributes: -------------------------------------------------------------------------------- 1 | *.m linguist-language=swift 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'RichTextDemo' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for RichTextDemo 9 | 10 | pod 'SnapKit' 11 | 12 | pod 'SDWebImage' 13 | 14 | pod 'MBProgressHUD', '~>0.9.2' 15 | 16 | 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MBProgressHUD (0.9.2) 3 | - SDWebImage (4.4.3): 4 | - SDWebImage/Core (= 4.4.3) 5 | - SDWebImage/Core (4.4.3) 6 | - SnapKit (4.2.0) 7 | 8 | DEPENDENCIES: 9 | - MBProgressHUD (~> 0.9.2) 10 | - SDWebImage 11 | - SnapKit 12 | 13 | SPEC REPOS: 14 | https://github.com/cocoapods/specs.git: 15 | - MBProgressHUD 16 | - SDWebImage 17 | - SnapKit 18 | 19 | SPEC CHECKSUMS: 20 | MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1 21 | SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508 22 | SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a 23 | 24 | PODFILE CHECKSUM: 7ffe7b4c14d1d686f9729878b1f79b106b5686e4 25 | 26 | COCOAPODS: 1.6.0.beta.2 27 | -------------------------------------------------------------------------------- /Pods/MBProgressHUD/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2015 Matej Bukovinski 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 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all 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. -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MBProgressHUD (0.9.2) 3 | - SDWebImage (4.4.3): 4 | - SDWebImage/Core (= 4.4.3) 5 | - SDWebImage/Core (4.4.3) 6 | - SnapKit (4.2.0) 7 | 8 | DEPENDENCIES: 9 | - MBProgressHUD (~> 0.9.2) 10 | - SDWebImage 11 | - SnapKit 12 | 13 | SPEC REPOS: 14 | https://github.com/cocoapods/specs.git: 15 | - MBProgressHUD 16 | - SDWebImage 17 | - SnapKit 18 | 19 | SPEC CHECKSUMS: 20 | MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1 21 | SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508 22 | SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a 23 | 24 | PODFILE CHECKSUM: 7ffe7b4c14d1d686f9729878b1f79b106b5686e4 25 | 26 | COCOAPODS: 1.6.0.beta.2 27 | -------------------------------------------------------------------------------- /Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | typedef NS_ENUM(NSInteger, SDImageFormat) { 14 | SDImageFormatUndefined = -1, 15 | SDImageFormatJPEG = 0, 16 | SDImageFormatPNG, 17 | SDImageFormatGIF, 18 | SDImageFormatTIFF, 19 | SDImageFormatWebP, 20 | SDImageFormatHEIC, 21 | SDImageFormatHEIF 22 | }; 23 | 24 | @interface NSData (ImageContentType) 25 | 26 | /** 27 | * Return image format 28 | * 29 | * @param data the input image data 30 | * 31 | * @return the image format as `SDImageFormat` (enum) 32 | */ 33 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 34 | 35 | /** 36 | * Convert SDImageFormat to UTType 37 | * 38 | * @param format Format as SDImageFormat 39 | * @return The UTType as CFStringRef 40 | */ 41 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format; 42 | 43 | /** 44 | * Convert UTTyppe to SDImageFormat 45 | * 46 | * @param uttype The UTType as CFStringRef 47 | * @return The Format as SDImageFormat 48 | */ 49 | + (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "NSData+ImageContentType.h" 11 | #if SD_MAC 12 | #import 13 | #else 14 | #import 15 | #endif 16 | 17 | // Currently Image/IO does not support WebP 18 | #define kSDUTTypeWebP ((__bridge CFStringRef)@"public.webp") 19 | // AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation 20 | #define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic") 21 | #define kSDUTTypeHEIF ((__bridge CFStringRef)@"public.heif") 22 | 23 | @implementation NSData (ImageContentType) 24 | 25 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { 26 | if (!data) { 27 | return SDImageFormatUndefined; 28 | } 29 | 30 | // File signatures table: http://www.garykessler.net/library/file_sigs.html 31 | uint8_t c; 32 | [data getBytes:&c length:1]; 33 | switch (c) { 34 | case 0xFF: 35 | return SDImageFormatJPEG; 36 | case 0x89: 37 | return SDImageFormatPNG; 38 | case 0x47: 39 | return SDImageFormatGIF; 40 | case 0x49: 41 | case 0x4D: 42 | return SDImageFormatTIFF; 43 | case 0x52: { 44 | if (data.length >= 12) { 45 | //RIFF....WEBP 46 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 47 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 48 | return SDImageFormatWebP; 49 | } 50 | } 51 | break; 52 | } 53 | case 0x00: { 54 | if (data.length >= 12) { 55 | //....ftypheic ....ftypheix ....ftyphevc ....ftyphevx 56 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(4, 8)] encoding:NSASCIIStringEncoding]; 57 | if ([testString isEqualToString:@"ftypheic"] 58 | || [testString isEqualToString:@"ftypheix"] 59 | || [testString isEqualToString:@"ftyphevc"] 60 | || [testString isEqualToString:@"ftyphevx"]) { 61 | return SDImageFormatHEIC; 62 | } 63 | if ([testString isEqualToString:@"ftypmif1"] || [testString isEqualToString:@"ftypmsf1"]) { 64 | return SDImageFormatHEIF; 65 | } 66 | } 67 | break; 68 | } 69 | } 70 | return SDImageFormatUndefined; 71 | } 72 | 73 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format { 74 | CFStringRef UTType; 75 | switch (format) { 76 | case SDImageFormatJPEG: 77 | UTType = kUTTypeJPEG; 78 | break; 79 | case SDImageFormatPNG: 80 | UTType = kUTTypePNG; 81 | break; 82 | case SDImageFormatGIF: 83 | UTType = kUTTypeGIF; 84 | break; 85 | case SDImageFormatTIFF: 86 | UTType = kUTTypeTIFF; 87 | break; 88 | case SDImageFormatWebP: 89 | UTType = kSDUTTypeWebP; 90 | break; 91 | case SDImageFormatHEIC: 92 | UTType = kSDUTTypeHEIC; 93 | break; 94 | case SDImageFormatHEIF: 95 | UTType = kSDUTTypeHEIF; 96 | break; 97 | default: 98 | // default is kUTTypePNG 99 | UTType = kUTTypePNG; 100 | break; 101 | } 102 | return UTType; 103 | } 104 | 105 | + (SDImageFormat)sd_imageFormatFromUTType:(CFStringRef)uttype { 106 | if (!uttype) { 107 | return SDImageFormatUndefined; 108 | } 109 | SDImageFormat imageFormat; 110 | if (CFStringCompare(uttype, kUTTypeJPEG, 0) == kCFCompareEqualTo) { 111 | imageFormat = SDImageFormatJPEG; 112 | } else if (CFStringCompare(uttype, kUTTypePNG, 0) == kCFCompareEqualTo) { 113 | imageFormat = SDImageFormatPNG; 114 | } else if (CFStringCompare(uttype, kUTTypeGIF, 0) == kCFCompareEqualTo) { 115 | imageFormat = SDImageFormatGIF; 116 | } else if (CFStringCompare(uttype, kUTTypeTIFF, 0) == kCFCompareEqualTo) { 117 | imageFormat = SDImageFormatTIFF; 118 | } else if (CFStringCompare(uttype, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { 119 | imageFormat = SDImageFormatWebP; 120 | } else if (CFStringCompare(uttype, kSDUTTypeHEIC, 0) == kCFCompareEqualTo) { 121 | imageFormat = SDImageFormatHEIC; 122 | } else if (CFStringCompare(uttype, kSDUTTypeHEIF, 0) == kCFCompareEqualTo) { 123 | imageFormat = SDImageFormatHEIF; 124 | } else { 125 | imageFormat = SDImageFormatUndefined; 126 | } 127 | return imageFormat; 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | @interface NSImage (WebCache) 16 | 17 | - (CGImageRef)CGImage; 18 | - (NSArray *)images; 19 | - (BOOL)isGIF; 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSImage+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSImage+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSImage (WebCache) 14 | 15 | - (CGImageRef)CGImage { 16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; 18 | return cgImage; 19 | } 20 | 21 | - (NSArray *)images { 22 | return nil; 23 | } 24 | 25 | - (BOOL)isGIF { 26 | BOOL isGIF = NO; 27 | for (NSImageRep *rep in self.representations) { 28 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 29 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep; 30 | NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; 31 | isGIF = frameCount > 1 ? YES : NO; 32 | break; 33 | } 34 | } 35 | return isGIF; 36 | } 37 | 38 | @end 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /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 | // A subclass of `NSBitmapImageRep` to fix that GIF loop count issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`. 14 | // Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDWebImageImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image. 15 | 16 | @interface SDAnimatedImageRep : NSBitmapImageRep 17 | 18 | @end 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /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 "SDWebImageGIFCoder.h" 14 | 15 | @interface SDWebImageGIFCoder () 16 | 17 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source; 18 | 19 | @end 20 | 21 | @interface SDAnimatedImageRep () 22 | 23 | @property (nonatomic, assign, readonly, nullable) CGImageSourceRef imageSource; 24 | 25 | @end 26 | 27 | @implementation SDAnimatedImageRep 28 | 29 | // `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. 30 | - (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value { 31 | [super setProperty:property withValue:value]; 32 | if ([property isEqualToString:NSImageCurrentFrame]) { 33 | // Access the image source 34 | CGImageSourceRef imageSource = self.imageSource; 35 | if (!imageSource) { 36 | return; 37 | } 38 | // Check format type 39 | CFStringRef type = CGImageSourceGetType(imageSource); 40 | if (!type) { 41 | return; 42 | } 43 | NSUInteger index = [value unsignedIntegerValue]; 44 | float frameDuration = 0; 45 | // Through we currently process GIF only, in the 5.x we support APNG so we keep the extensibility 46 | if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) { 47 | frameDuration = [[SDWebImageGIFCoder sharedCoder] sd_frameDurationAtIndex:index source:imageSource]; 48 | } 49 | if (!frameDuration) { 50 | return; 51 | } 52 | // Reset super frame duration with the actual frame duration 53 | [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)]; 54 | } 55 | } 56 | 57 | - (CGImageSourceRef)imageSource { 58 | if (_tiffData) { 59 | return (__bridge CGImageSourceRef)(_tiffData); 60 | } 61 | return NULL; 62 | } 63 | 64 | @end 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) { 13 | /** 14 | * When the image is accessed it will update this value 15 | */ 16 | SDImageCacheConfigExpireTypeAccessDate, 17 | /** 18 | * The image was obtained from the disk cache (Default) 19 | */ 20 | SDImageCacheConfigExpireTypeModificationDate 21 | }; 22 | 23 | @interface SDImageCacheConfig : NSObject 24 | 25 | /** 26 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 27 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 28 | */ 29 | @property (assign, nonatomic) BOOL shouldDecompressImages; 30 | 31 | /** 32 | * Whether or not to disable iCloud backup 33 | * Defaults to YES. 34 | */ 35 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 36 | 37 | /** 38 | * Whether or not to use memory cache 39 | * @note When the memory cache is disabled, the weak memory cache will also be disabled. 40 | * Defaults to YES. 41 | */ 42 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 43 | 44 | /** 45 | * The option to control weak memory cache for images. When enable, `SDImageCache`'s memory cache will use a weak maptable to store the image at the same time when it stored to memory, and get removed at the same time. 46 | * However when memory warning is triggered, since the weak maptable does not hold a strong reference to image instacnce, even when the memory cache itself is purged, some images which are held strongly by UIImageViews or other live instances can be recovered again, to avoid later re-query from disk cache or network. This may be helpful for the case, for example, when app enter background and memory is purged, cause cell flashing after re-enter foreground. 47 | * Defautls to YES. You can change this option dynamically. 48 | */ 49 | @property (assign, nonatomic) BOOL shouldUseWeakMemoryCache; 50 | 51 | /** 52 | * The reading options while reading cache from disk. 53 | * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance. 54 | */ 55 | @property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions; 56 | 57 | /** 58 | * The writing options while writing cache to disk. 59 | * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file. 60 | */ 61 | @property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions; 62 | 63 | /** 64 | * The maximum length of time to keep an image in the cache, in seconds. 65 | */ 66 | @property (assign, nonatomic) NSInteger maxCacheAge; 67 | 68 | /** 69 | * The maximum size of the cache, in bytes. 70 | */ 71 | @property (assign, nonatomic) NSUInteger maxCacheSize; 72 | 73 | /** 74 | * The attribute which the clear cache will be checked against when clearing the disk cache 75 | * Default is Modified Date 76 | */ 77 | @property (assign, nonatomic) SDImageCacheConfigExpireType diskCacheExpireType; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCacheConfig.h" 10 | 11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week 12 | 13 | @implementation SDImageCacheConfig 14 | 15 | - (instancetype)init { 16 | if (self = [super init]) { 17 | _shouldDecompressImages = YES; 18 | _shouldDisableiCloud = YES; 19 | _shouldCacheImagesInMemory = YES; 20 | _shouldUseWeakMemoryCache = YES; 21 | _diskCacheReadingOptions = 0; 22 | _diskCacheWritingOptions = NSDataWritingAtomic; 23 | _maxCacheAge = kDefaultCacheMaxCacheAge; 24 | _maxCacheSize = 0; 25 | _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate; 26 | } 27 | return self; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | #import "NSData+ImageContentType.h" 12 | 13 | /** 14 | A Boolean value indicating whether to scale down large images during decompressing. (NSNumber) 15 | */ 16 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageCoderScaleDownLargeImagesKey; 17 | 18 | /** 19 | Return the shared device-dependent RGB color space created with CGColorSpaceCreateDeviceRGB. 20 | 21 | @return The device-dependent RGB color space 22 | */ 23 | CG_EXTERN CGColorSpaceRef _Nonnull SDCGColorSpaceGetDeviceRGB(void); 24 | 25 | /** 26 | Check whether CGImageRef contains alpha channel. 27 | 28 | @param imageRef The CGImageRef 29 | @return Return YES if CGImageRef contains alpha channel, otherwise return NO 30 | */ 31 | CG_EXTERN BOOL SDCGImageRefContainsAlpha(_Nullable CGImageRef imageRef); 32 | 33 | 34 | /** 35 | This is the image coder protocol to provide custom image decoding/encoding. 36 | These methods are all required to implement. 37 | @note Pay attention that these methods are not called from main queue. 38 | */ 39 | @protocol SDWebImageCoder 40 | 41 | @required 42 | #pragma mark - Decoding 43 | /** 44 | Returns YES if this coder can decode some data. Otherwise, the data should be passed to another coder. 45 | 46 | @param data The image data so we can look at it 47 | @return YES if this coder can decode the data, NO otherwise 48 | */ 49 | - (BOOL)canDecodeFromData:(nullable NSData *)data; 50 | 51 | /** 52 | Decode the image data to image. 53 | 54 | @param data The image data to be decoded 55 | @return The decoded image from data 56 | */ 57 | - (nullable UIImage *)decodedImageWithData:(nullable NSData *)data; 58 | 59 | /** 60 | Decompress the image with original image and image data. 61 | 62 | @param image The original image to be decompressed 63 | @param data The pointer to original image data. The pointer itself is nonnull but image data can be null. This data will set to cache if needed. If you do not need to modify data at the sametime, ignore this param. 64 | @param optionsDict A dictionary containing any decompressing options. Pass {SDWebImageCoderScaleDownLargeImagesKey: @(YES)} to scale down large images 65 | @return The decompressed image 66 | */ 67 | - (nullable UIImage *)decompressedImageWithImage:(nullable UIImage *)image 68 | data:(NSData * _Nullable * _Nonnull)data 69 | options:(nullable NSDictionary*)optionsDict; 70 | 71 | #pragma mark - Encoding 72 | 73 | /** 74 | Returns YES if this coder can encode some image. Otherwise, it should be passed to another coder. 75 | 76 | @param format The image format 77 | @return YES if this coder can encode the image, NO otherwise 78 | */ 79 | - (BOOL)canEncodeToFormat:(SDImageFormat)format; 80 | 81 | /** 82 | Encode the image to image data. 83 | 84 | @param image The image to be encoded 85 | @param format The image format to encode, you should note `SDImageFormatUndefined` format is also possible 86 | @return The encoded image data 87 | */ 88 | - (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image format:(SDImageFormat)format; 89 | 90 | @end 91 | 92 | 93 | /** 94 | This is the image coder protocol to provide custom progressive image decoding. 95 | These methods are all required to implement. 96 | @note Pay attention that these methods are not called from main queue. 97 | */ 98 | @protocol SDWebImageProgressiveCoder 99 | 100 | @required 101 | /** 102 | Returns YES if this coder can incremental decode some data. Otherwise, it should be passed to another coder. 103 | 104 | @param data The image data so we can look at it 105 | @return YES if this coder can decode the data, NO otherwise 106 | */ 107 | - (BOOL)canIncrementallyDecodeFromData:(nullable NSData *)data; 108 | 109 | /** 110 | Incremental decode the image data to image. 111 | 112 | @param data The image data has been downloaded so far 113 | @param finished Whether the download has finished 114 | @warning because incremental decoding need to keep the decoded context, we will alloc a new instance with the same class for each download operation to avoid conflicts 115 | @return The decoded image from data 116 | */ 117 | - (nullable UIImage *)incrementallyDecodedImageWithData:(nullable NSData *)data finished:(BOOL)finished; 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCoder.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 "SDWebImageCoder.h" 10 | 11 | NSString * const SDWebImageCoderScaleDownLargeImagesKey = @"scaleDownLargeImages"; 12 | 13 | CGColorSpaceRef SDCGColorSpaceGetDeviceRGB(void) { 14 | static CGColorSpaceRef colorSpace; 15 | static dispatch_once_t onceToken; 16 | dispatch_once(&onceToken, ^{ 17 | colorSpace = CGColorSpaceCreateDeviceRGB(); 18 | }); 19 | return colorSpace; 20 | } 21 | 22 | BOOL SDCGImageRefContainsAlpha(CGImageRef imageRef) { 23 | if (!imageRef) { 24 | return NO; 25 | } 26 | CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef); 27 | BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || 28 | alphaInfo == kCGImageAlphaNoneSkipFirst || 29 | alphaInfo == kCGImageAlphaNoneSkipLast); 30 | return hasAlpha; 31 | } 32 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCoderHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | #import "SDWebImageFrame.h" 12 | 13 | @interface SDWebImageCoderHelper : NSObject 14 | 15 | /** 16 | Return an animated image with frames array. 17 | For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work. 18 | For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not) 19 | 20 | @param frames The frames array. If no frames or frames is empty, return nil 21 | @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit) 22 | */ 23 | + (UIImage * _Nullable)animatedImageWithFrames:(NSArray * _Nullable)frames; 24 | 25 | /** 26 | Return frames array from an animated image. 27 | For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage. 28 | For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array. 29 | 30 | @param animatedImage A animated image. If it's not animated, return nil 31 | @return The frames array 32 | */ 33 | + (NSArray * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage; 34 | 35 | #if SD_UIKIT || SD_WATCH 36 | /** 37 | Convert an EXIF image orientation to an iOS one. 38 | 39 | @param exifOrientation EXIF orientation 40 | @return iOS orientation 41 | */ 42 | + (UIImageOrientation)imageOrientationFromEXIFOrientation:(NSInteger)exifOrientation; 43 | /** 44 | Convert an iOS orientation to an EXIF image orientation. 45 | 46 | @param imageOrientation iOS orientation 47 | @return EXIF orientation 48 | */ 49 | + (NSInteger)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation; 50 | #endif 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCodersManager.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 "SDWebImageCoder.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`, `WebPCoder`. (`GIFCoder` is not recommended to add only if you want to get GIF support without `FLAnimatedImage`) 21 | - calling `coders` will return `@[WebPCoder, IOCoder]` 22 | - call `[addCoder:[MyCrazyCoder new]]` 23 | - calling `coders` now returns `@[MyCrazyCoder, WebPCoder, IOCoder]` 24 | 25 | Coders 26 | ------ 27 | A coder must conform to the `SDWebImageCoder` protocol or even to `SDWebImageProgressiveCoder` 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 SDWebImageCodersManager : NSObject 33 | 34 | /** 35 | Shared reusable instance 36 | */ 37 | + (nonnull instancetype)sharedInstance; 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, readwrite, 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/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | // Apple's defines from TargetConditionals.h are a bit weird. 17 | // Seems like TARGET_OS_MAC is always defined (on all platforms). 18 | // To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms 19 | #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH 20 | #define SD_MAC 1 21 | #else 22 | #define SD_MAC 0 23 | #endif 24 | 25 | // iOS and tvOS are very similar, UIKit exists on both platforms 26 | // Note: watchOS also has UIKit, but it's very limited 27 | #if TARGET_OS_IOS || TARGET_OS_TV 28 | #define SD_UIKIT 1 29 | #else 30 | #define SD_UIKIT 0 31 | #endif 32 | 33 | #if TARGET_OS_IOS 34 | #define SD_IOS 1 35 | #else 36 | #define SD_IOS 0 37 | #endif 38 | 39 | #if TARGET_OS_TV 40 | #define SD_TV 1 41 | #else 42 | #define SD_TV 0 43 | #endif 44 | 45 | #if TARGET_OS_WATCH 46 | #define SD_WATCH 1 47 | #else 48 | #define SD_WATCH 0 49 | #endif 50 | 51 | 52 | #if SD_MAC 53 | #import 54 | #ifndef UIImage 55 | #define UIImage NSImage 56 | #endif 57 | #ifndef UIImageView 58 | #define UIImageView NSImageView 59 | #endif 60 | #ifndef UIView 61 | #define UIView NSView 62 | #endif 63 | #else 64 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 65 | #error SDWebImage doesn't support Deployment Target version < 5.0 66 | #endif 67 | 68 | #if SD_UIKIT 69 | #import 70 | #endif 71 | #if SD_WATCH 72 | #import 73 | #ifndef UIView 74 | #define UIView WKInterfaceObject 75 | #endif 76 | #ifndef UIImageView 77 | #define UIImageView WKInterfaceImage 78 | #endif 79 | #endif 80 | #endif 81 | 82 | #ifndef NS_ENUM 83 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 84 | #endif 85 | 86 | #ifndef NS_OPTIONS 87 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 88 | #endif 89 | 90 | FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 91 | 92 | typedef void(^SDWebImageNoParamsBlock)(void); 93 | 94 | FOUNDATION_EXPORT NSString *const SDWebImageErrorDomain; 95 | 96 | #ifndef dispatch_queue_async_safe 97 | #define dispatch_queue_async_safe(queue, block)\ 98 | if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(queue)) {\ 99 | block();\ 100 | } else {\ 101 | dispatch_async(queue, block);\ 102 | } 103 | #endif 104 | 105 | #ifndef dispatch_main_async_safe 106 | #define dispatch_main_async_safe(block) dispatch_queue_async_safe(dispatch_get_main_queue(), block) 107 | #endif 108 | -------------------------------------------------------------------------------- /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 | #import "UIImage+MultiFormat.h" 11 | 12 | #if !__has_feature(objc_arc) 13 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 14 | #endif 15 | 16 | #if !OS_OBJECT_USE_OBJC 17 | #error SDWebImage need ARC for dispatch object 18 | #endif 19 | 20 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { 21 | if (!image) { 22 | return nil; 23 | } 24 | 25 | #if SD_MAC 26 | return image; 27 | #elif SD_UIKIT || SD_WATCH 28 | if ((image.images).count > 0) { 29 | NSMutableArray *scaledImages = [NSMutableArray array]; 30 | 31 | for (UIImage *tempImage in image.images) { 32 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 33 | } 34 | 35 | UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 36 | if (animatedImage) { 37 | animatedImage.sd_imageLoopCount = image.sd_imageLoopCount; 38 | animatedImage.sd_imageFormat = image.sd_imageFormat; 39 | } 40 | return animatedImage; 41 | } else { 42 | #if SD_WATCH 43 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { 44 | #elif SD_UIKIT 45 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 46 | #endif 47 | CGFloat scale = 1; 48 | if (key.length >= 8) { 49 | NSRange range = [key rangeOfString:@"@2x."]; 50 | if (range.location != NSNotFound) { 51 | scale = 2.0; 52 | } 53 | 54 | range = [key rangeOfString:@"@3x."]; 55 | if (range.location != NSNotFound) { 56 | scale = 3.0; 57 | } 58 | } 59 | 60 | if (scale != image.scale) { 61 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 62 | scaledImage.sd_imageFormat = image.sd_imageFormat; 63 | image = scaledImage; 64 | } 65 | } 66 | return image; 67 | } 68 | #endif 69 | } 70 | 71 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 72 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageFrame.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 SDWebImageFrame : NSObject 13 | 14 | // This class is used for creating animated images via `animatedImageWithFrames` in `SDWebImageCoderHelper`. Attention if you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+MultiFormat`. 15 | 16 | /** 17 | The image of current frame. You should not set an animated image. 18 | */ 19 | @property (nonatomic, strong, readonly, nonnull) UIImage *image; 20 | /** 21 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero. 22 | */ 23 | @property (nonatomic, readonly, assign) NSTimeInterval duration; 24 | 25 | /** 26 | Create a frame instance with specify image and duration 27 | 28 | @param image current frame's image 29 | @param duration current frame's duration 30 | @return frame instance 31 | */ 32 | + (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageFrame.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 "SDWebImageFrame.h" 10 | 11 | @interface SDWebImageFrame () 12 | 13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image; 14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration; 15 | 16 | @end 17 | 18 | @implementation SDWebImageFrame 19 | 20 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration { 21 | SDWebImageFrame *frame = [[SDWebImageFrame alloc] init]; 22 | frame.image = image; 23 | frame.duration = duration; 24 | 25 | return frame; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageGIFCoder.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 "SDWebImageCoder.h" 11 | 12 | /** 13 | Built in coder using ImageIO that supports GIF encoding/decoding 14 | @note `SDWebImageIOCoder` supports GIF but only as static (will use the 1st frame). 15 | @note Use `SDWebImageGIFCoder` for fully animated GIFs - less performant than `FLAnimatedImage` 16 | @note If you decide to make all `UIImageView`(including `FLAnimatedImageView`) instance support GIF. You should add this coder to `SDWebImageCodersManager` and make sure that it has a higher priority than `SDWebImageIOCoder` 17 | @note The recommended approach for animated GIFs is using `FLAnimatedImage`. It's more performant than `UIImageView` for GIF displaying 18 | */ 19 | @interface SDWebImageGIFCoder : NSObject 20 | 21 | + (nonnull instancetype)sharedCoder; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageImageIOCoder.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 "SDWebImageCoder.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 `FLAnimatedImage` or our less performant `SDWebImageGIFCoder` 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 SDWebImageImageIOCoder : NSObject 27 | 28 | + (nonnull instancetype)sharedCoder; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched (successful or not) 24 | * @param totalCount The total number of images that were to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; 27 | 28 | /** 29 | * Called when all images are prefetched. 30 | * @param imagePrefetcher The current image prefetcher 31 | * @param totalCount The total number of images that were prefetched (whether successful or not) 32 | * @param skippedCount The total number of images that were skipped 33 | */ 34 | - (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; 35 | 36 | @end 37 | 38 | typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); 39 | typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); 40 | 41 | /** 42 | * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. 43 | */ 44 | @interface SDWebImagePrefetcher : NSObject 45 | 46 | /** 47 | * The web image manager 48 | */ 49 | @property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; 50 | 51 | /** 52 | * Maximum number of URLs to prefetch at the same time. Defaults to 3. 53 | */ 54 | @property (nonatomic, assign) NSUInteger maxConcurrentDownloads; 55 | 56 | /** 57 | * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. 58 | */ 59 | @property (nonatomic, assign) SDWebImageOptions options; 60 | 61 | /** 62 | * Queue options for Prefetcher. Defaults to Main Queue. 63 | */ 64 | @property (strong, nonatomic, nonnull) dispatch_queue_t prefetcherQueue; 65 | 66 | @property (weak, nonatomic, nullable) id delegate; 67 | 68 | /** 69 | * Return the global image prefetcher instance. 70 | */ 71 | + (nonnull instancetype)sharedImagePrefetcher; 72 | 73 | /** 74 | * Allows you to instantiate a prefetcher with any arbitrary image manager. 75 | */ 76 | - (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; 77 | 78 | /** 79 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 80 | * currently one image is downloaded at a time, 81 | * and skips images for failed downloads and proceed to the next image in the list. 82 | * Any previously-running prefetch operations are canceled. 83 | * 84 | * @param urls list of URLs to prefetch 85 | */ 86 | - (void)prefetchURLs:(nullable NSArray *)urls; 87 | 88 | /** 89 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 90 | * currently one image is downloaded at a time, 91 | * and skips images for failed downloads and proceed to the next image in the list. 92 | * Any previously-running prefetch operations are canceled. 93 | * 94 | * @param urls list of URLs to prefetch 95 | * @param progressBlock block to be called when progress updates; 96 | * first parameter is the number of completed (successful or not) requests, 97 | * second parameter is the total number of images originally requested to be prefetched 98 | * @param completionBlock block to be called when prefetching is completed 99 | * first param is the number of completed (successful or not) requests, 100 | * second parameter is the number of skipped requests 101 | */ 102 | - (void)prefetchURLs:(nullable NSArray *)urls 103 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 104 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; 105 | 106 | /** 107 | * Remove and cancel queued list 108 | */ 109 | - (void)cancelPrefetching; 110 | 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageTransition.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 | #import "SDImageCache.h" 13 | 14 | // This class is used to provide a transition animation after the view category load image finished. Use this on `sd_imageTransition` in UIView+WebCache.h 15 | // for UIKit(iOS & tvOS), we use `+[UIView transitionWithView:duration:options:animations:completion]` for transition animation. 16 | // for AppKit(macOS), we use `+[NSAnimationContext runAnimationGroup:completionHandler:]` for transition animation. You can call `+[NSAnimationContext currentContext]` to grab the context during animations block. 17 | // These transition are provided for basic usage. If you need complicated animation, consider to directly use Core Animation or use `SDWebImageAvoidAutoSetImage` and implement your own after image load finished. 18 | 19 | #if SD_UIKIT 20 | typedef UIViewAnimationOptions SDWebImageAnimationOptions; 21 | #else 22 | typedef NS_OPTIONS(NSUInteger, SDWebImageAnimationOptions) { 23 | SDWebImageAnimationOptionAllowsImplicitAnimation = 1 << 0, // specify `allowsImplicitAnimation` for the `NSAnimationContext` 24 | }; 25 | #endif 26 | 27 | typedef void (^SDWebImageTransitionPreparesBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL); 28 | typedef void (^SDWebImageTransitionAnimationsBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image); 29 | typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished); 30 | 31 | @interface SDWebImageTransition : NSObject 32 | 33 | /** 34 | By default, we set the image to the view at the beginning of the animtions. You can disable this and provide custom set image process 35 | */ 36 | @property (nonatomic, assign) BOOL avoidAutoSetImage; 37 | /** 38 | The duration of the transition animation, measured in seconds. Defaults to 0.5. 39 | */ 40 | @property (nonatomic, assign) NSTimeInterval duration; 41 | /** 42 | The timing function used for all animations within this transition animation (macOS). 43 | */ 44 | @property (nonatomic, strong, nullable) CAMediaTimingFunction *timingFunction NS_AVAILABLE_MAC(10_7); 45 | /** 46 | A mask of options indicating how you want to perform the animations. 47 | */ 48 | @property (nonatomic, assign) SDWebImageAnimationOptions animationOptions; 49 | /** 50 | A block object to be executed before the animation sequence starts. 51 | */ 52 | @property (nonatomic, copy, nullable) SDWebImageTransitionPreparesBlock prepares; 53 | /** 54 | A block object that contains the changes you want to make to the specified view. 55 | */ 56 | @property (nonatomic, copy, nullable) SDWebImageTransitionAnimationsBlock animations; 57 | /** 58 | A block object to be executed when the animation sequence ends. 59 | */ 60 | @property (nonatomic, copy, nullable) SDWebImageTransitionCompletionBlock completion; 61 | 62 | @end 63 | 64 | // Convenience way to create transition. Remember to specify the duration if needed. 65 | // for UIKit, these transition just use the correspond `animationOptions`. By default we enable `UIViewAnimationOptionAllowUserInteraction` to allow user interaction during transition. 66 | // for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it. 67 | 68 | @interface SDWebImageTransition (Conveniences) 69 | 70 | // class property is available in Xcode 8. We will drop the Xcode 7.3 support in 5.x 71 | #if __has_feature(objc_class_property) 72 | /// Fade transition. 73 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition; 74 | /// Flip from left transition. 75 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition; 76 | /// Flip from right transition. 77 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromRightTransition; 78 | /// Flip from top transition. 79 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromTopTransition; 80 | /// Flip from bottom transition. 81 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromBottomTransition; 82 | /// Curl up transition. 83 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlUpTransition; 84 | /// Curl down transition. 85 | @property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition; 86 | #else 87 | + (nonnull instancetype)fadeTransition; 88 | + (nonnull instancetype)flipFromLeftTransition; 89 | + (nonnull instancetype)flipFromRightTransition; 90 | + (nonnull instancetype)flipFromTopTransition; 91 | + (nonnull instancetype)flipFromBottomTransition; 92 | + (nonnull instancetype)curlUpTransition; 93 | + (nonnull instancetype)curlDownTransition; 94 | #endif 95 | 96 | @end 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /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 | @interface UIImage (ForceDecode) 12 | 13 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; 14 | 15 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /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 "SDWebImageCodersManager.h" 11 | 12 | @implementation UIImage (ForceDecode) 13 | 14 | + (UIImage *)decodedImageWithImage:(UIImage *)image { 15 | if (!image) { 16 | return nil; 17 | } 18 | NSData *tempData; 19 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(NO)}]; 20 | } 21 | 22 | + (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image { 23 | if (!image) { 24 | return nil; 25 | } 26 | NSData *tempData; 27 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(YES)}]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface UIImage (GIF) 13 | 14 | /** 15 | * Creates an animated UIImage from an NSData. 16 | * For static GIF, will create an UIImage with `images` array set to nil. For animated GIF, will create an UIImage with valid `images` array. 17 | */ 18 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 19 | 20 | /** 21 | * Checks if an UIImage instance is a GIF. Will use the `images` array. 22 | */ 23 | - (BOOL)isGIF; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "UIImage+GIF.h" 11 | #import "SDWebImageGIFCoder.h" 12 | #import "NSImage+WebCache.h" 13 | 14 | @implementation UIImage (GIF) 15 | 16 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 17 | if (!data) { 18 | return nil; 19 | } 20 | return [[SDWebImageGIFCoder sharedCoder] decodedImageWithData:data]; 21 | } 22 | 23 | - (BOOL)isGIF { 24 | return (self.images != nil); 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "NSData+ImageContentType.h" 11 | 12 | @interface UIImage (MultiFormat) 13 | 14 | /** 15 | * UIKit: 16 | * For static image format, this value is always 0. 17 | * For animated image format, 0 means infinite looping. 18 | * @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. 19 | * AppKit: 20 | * NSImage currently only support animated via GIF imageRep unlike UIImage. 21 | * The getter of this property will get the loop count from GIF imageRep 22 | * The setter of this property will set the loop count from GIF imageRep 23 | */ 24 | @property (nonatomic, assign) NSUInteger sd_imageLoopCount; 25 | 26 | /** 27 | * The image format represent the original compressed image data format. 28 | * 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. 29 | * @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. 30 | */ 31 | @property (nonatomic, assign) SDImageFormat sd_imageFormat; 32 | 33 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 34 | - (nullable NSData *)sd_imageData; 35 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /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 "NSImage+WebCache.h" 11 | #import "SDWebImageCodersManager.h" 12 | #import "objc/runtime.h" 13 | 14 | @implementation UIImage (MultiFormat) 15 | 16 | #if SD_MAC 17 | - (NSUInteger)sd_imageLoopCount { 18 | NSUInteger imageLoopCount = 0; 19 | for (NSImageRep *rep in self.representations) { 20 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 21 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep; 22 | imageLoopCount = [[bitmapRep valueForProperty:NSImageLoopCount] unsignedIntegerValue]; 23 | break; 24 | } 25 | } 26 | return imageLoopCount; 27 | } 28 | 29 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { 30 | for (NSImageRep *rep in self.representations) { 31 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) { 32 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep; 33 | [bitmapRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)]; 34 | break; 35 | } 36 | } 37 | } 38 | 39 | #else 40 | 41 | - (NSUInteger)sd_imageLoopCount { 42 | NSUInteger imageLoopCount = 0; 43 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount)); 44 | if ([value isKindOfClass:[NSNumber class]]) { 45 | imageLoopCount = value.unsignedIntegerValue; 46 | } 47 | return imageLoopCount; 48 | } 49 | 50 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { 51 | NSNumber *value = @(sd_imageLoopCount); 52 | objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 53 | } 54 | #endif 55 | 56 | - (SDImageFormat)sd_imageFormat { 57 | SDImageFormat imageFormat = SDImageFormatUndefined; 58 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFormat)); 59 | if ([value isKindOfClass:[NSNumber class]]) { 60 | imageFormat = value.integerValue; 61 | return imageFormat; 62 | } 63 | // Check CGImage's UTType, may return nil for non-Image/IO based image 64 | #pragma clang diagnostic push 65 | #pragma clang diagnostic ignored "-Wunguarded-availability" 66 | if (&CGImageGetUTType != NULL) { 67 | CFStringRef uttype = CGImageGetUTType(self.CGImage); 68 | imageFormat = [NSData sd_imageFormatFromUTType:uttype]; 69 | } 70 | #pragma clang diagnostic pop 71 | return imageFormat; 72 | } 73 | 74 | - (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat { 75 | objc_setAssociatedObject(self, @selector(sd_imageFormat), @(sd_imageFormat), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 76 | } 77 | 78 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { 79 | return [[SDWebImageCodersManager sharedInstance] decodedImageWithData:data]; 80 | } 81 | 82 | - (nullable NSData *)sd_imageData { 83 | return [self sd_imageDataAsFormat:SDImageFormatUndefined]; 84 | } 85 | 86 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { 87 | NSData *imageData = nil; 88 | if (self) { 89 | imageData = [[SDWebImageCodersManager sharedInstance] encodedDataWithImage:self format:imageFormat]; 90 | } 91 | return imageData; 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 17 | */ 18 | @interface UIImageView (HighlightedWebCache) 19 | 20 | /** 21 | * Set the imageView `highlightedImage` with an `url`. 22 | * 23 | * The download is asynchronous and cached. 24 | * 25 | * @param url The url for the image. 26 | */ 27 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; 28 | 29 | /** 30 | * Set the imageView `highlightedImage` with an `url` and custom options. 31 | * 32 | * The download is asynchronous and cached. 33 | * 34 | * @param url The url for the image. 35 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 36 | */ 37 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 38 | options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; 39 | 40 | /** 41 | * Set the imageView `highlightedImage` with an `url`. 42 | * 43 | * The download is asynchronous and cached. 44 | * 45 | * @param url The url for the image. 46 | * @param completedBlock A block called when operation has been completed. This block has no return value 47 | * and takes the requested UIImage as first parameter. In case of error the image parameter 48 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 49 | * indicating if the image was retrieved from the local cache or from the network. 50 | * The fourth parameter is the original image url. 51 | */ 52 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 53 | completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; 54 | 55 | /** 56 | * Set the imageView `highlightedImage` with an `url` and custom options. 57 | * 58 | * The download is asynchronous and cached. 59 | * 60 | * @param url The url for the image. 61 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 62 | * @param completedBlock A block called when operation has been completed. This block has no return value 63 | * and takes the requested UIImage as first parameter. In case of error the image parameter 64 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 65 | * indicating if the image was retrieved from the local cache or from the network. 66 | * The fourth parameter is the original image url. 67 | */ 68 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 69 | options:(SDWebImageOptions)options 70 | completed:(nullable SDExternalCompletionBlock)completedBlock; 71 | 72 | /** 73 | * Set the imageView `highlightedImage` with an `url` and custom options. 74 | * 75 | * The download is asynchronous and cached. 76 | * 77 | * @param url The url for the image. 78 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 79 | * @param progressBlock A block called while image is downloading 80 | * @note the progress block is executed on a background queue 81 | * @param completedBlock A block called when operation has been completed. This block has no return value 82 | * and takes the requested UIImage as first parameter. In case of error the image parameter 83 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 84 | * indicating if the image was retrieved from the local cache or from the network. 85 | * The fourth parameter is the original image url. 86 | */ 87 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 88 | options:(SDWebImageOptions)options 89 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 90 | completed:(nullable SDExternalCompletionBlock)completedBlock; 91 | 92 | @end 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+HighlightedWebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "UIView+WebCacheOperation.h" 14 | #import "UIView+WebCache.h" 15 | 16 | @implementation UIImageView (HighlightedWebCache) 17 | 18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { 19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 20 | } 21 | 22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { 23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 28 | } 29 | 30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 32 | } 33 | 34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 35 | options:(SDWebImageOptions)options 36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 37 | completed:(nullable SDExternalCompletionBlock)completedBlock { 38 | __weak typeof(self)weakSelf = self; 39 | [self sd_internalSetImageWithURL:url 40 | placeholderImage:nil 41 | options:options 42 | operationKey:@"UIImageViewImageOperationHighlighted" 43 | setImageBlock:^(UIImage *image, NSData *imageData) { 44 | weakSelf.highlightedImage = image; 45 | } 46 | progress:progressBlock 47 | completed:completedBlock]; 48 | } 49 | 50 | @end 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Pods/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 | // These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external. 13 | // 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. 14 | @interface UIView (WebCacheOperation) 15 | 16 | /** 17 | * Set the image load operation (storage in a UIView based weak map table) 18 | * 19 | * @param operation the operation 20 | * @param key key for storing the operation 21 | */ 22 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 23 | 24 | /** 25 | * Cancel all operations for the current UIView and key 26 | * 27 | * @param key key for identifying the operations 28 | */ 29 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 30 | 31 | /** 32 | * Just remove the operations corresponding to the current UIView and key without cancelling them 33 | * 34 | * @param key key for identifying the operations 35 | */ 36 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /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 copy, 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 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { 33 | if (key) { 34 | [self sd_cancelImageLoadOperationWithKey:key]; 35 | if (operation) { 36 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 37 | @synchronized (self) { 38 | [operationDictionary setObject:operation forKey:key]; 39 | } 40 | } 41 | } 42 | } 43 | 44 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { 45 | if (key) { 46 | // Cancel in progress downloader from queue 47 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 48 | id operation; 49 | 50 | @synchronized (self) { 51 | operation = [operationDictionary objectForKey:key]; 52 | } 53 | if (operation) { 54 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { 55 | [operation cancel]; 56 | } 57 | @synchronized (self) { 58 | [operationDictionary removeObjectForKey:key]; 59 | } 60 | } 61 | } 62 | } 63 | 64 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { 65 | if (key) { 66 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; 67 | @synchronized (self) { 68 | [operationDictionary removeObjectForKey:key]; 69 | } 70 | } 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Pods/SnapKit/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 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 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all 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 | -------------------------------------------------------------------------------- /Pods/SnapKit/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. 4 | 5 | [![Build Status](https://travis-ci.org/SnapKit/SnapKit.svg)](https://travis-ci.org/SnapKit/SnapKit) 6 | [![Platform](https://img.shields.io/cocoapods/p/SnapKit.svg?style=flat)](https://github.com/SnapKit/SnapKit) 7 | [![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://cocoapods.org/pods/SnapKit) 8 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 9 | 10 | #### ⚠️ **To use with Swift 3.x please ensure you are using >= 3.0.0** ⚠️ 11 | #### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️ 12 | 13 | ## Contents 14 | 15 | - [Requirements](#requirements) 16 | - [Migration Guides](#migration-guides) 17 | - [Communication](#communication) 18 | - [Installation](#installation) 19 | - [Usage](#usage) 20 | - [Credits](#credits) 21 | - [License](#license) 22 | 23 | ## Requirements 24 | 25 | - iOS 8.0+ / Mac OS X 10.11+ / tvOS 9.0+ 26 | - Xcode 9.0+ 27 | - Swift 3.0+ 28 | 29 | ## Communication 30 | 31 | - If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit') 32 | - If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). 33 | - If you **found a bug**, open an issue. 34 | - If you **have a feature request**, open an issue. 35 | - If you **want to contribute**, submit a pull request. 36 | 37 | 38 | ## Installation 39 | 40 | ### CocoaPods 41 | 42 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: 43 | 44 | ```bash 45 | $ gem install cocoapods 46 | ``` 47 | 48 | > CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+. 49 | 50 | To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`: 51 | 52 | ```ruby 53 | source 'https://github.com/CocoaPods/Specs.git' 54 | platform :ios, '10.0' 55 | use_frameworks! 56 | 57 | target '' do 58 | pod 'SnapKit', '~> 4.0.0' 59 | end 60 | ``` 61 | 62 | Then, run the following command: 63 | 64 | ```bash 65 | $ pod install 66 | ``` 67 | 68 | ### Carthage 69 | 70 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. 71 | 72 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command: 73 | 74 | ```bash 75 | $ brew update 76 | $ brew install carthage 77 | ``` 78 | 79 | To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`: 80 | 81 | ```ogdl 82 | github "SnapKit/SnapKit" ~> 4.0.0 83 | ``` 84 | 85 | Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project. 86 | 87 | ### Manually 88 | 89 | If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually. 90 | 91 | --- 92 | 93 | ## Usage 94 | 95 | ### Quick Start 96 | 97 | ```swift 98 | import SnapKit 99 | 100 | class MyViewController: UIViewController { 101 | 102 | lazy var box = UIView() 103 | 104 | override func viewDidLoad() { 105 | super.viewDidLoad() 106 | 107 | self.view.addSubview(box) 108 | box.snp.makeConstraints { (make) -> Void in 109 | make.width.height.equalTo(50) 110 | make.center.equalTo(self.view) 111 | } 112 | } 113 | 114 | } 115 | ``` 116 | 117 | ### Resources 118 | 119 | - [Documentation](http://snapkit.io/docs/) 120 | - [F.A.Q.](http://snapkit.io/faq/) 121 | 122 | ## Credits 123 | 124 | - Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne)) 125 | - Many other contributors 126 | 127 | ## License 128 | 129 | SnapKit is released under the MIT license. See LICENSE for details. 130 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintConfig.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection 27 | #else 28 | import AppKit 29 | public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection 30 | #endif 31 | 32 | 33 | public struct ConstraintConfig { 34 | 35 | public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintDescription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintDescription { 32 | 33 | internal let item: LayoutConstraintItem 34 | internal var attributes: ConstraintAttributes 35 | internal var relation: ConstraintRelation? = nil 36 | internal var sourceLocation: (String, UInt)? = nil 37 | internal var label: String? = nil 38 | internal var related: ConstraintItem? = nil 39 | internal var multiplier: ConstraintMultiplierTarget = 1.0 40 | internal var constant: ConstraintConstantTarget = 0.0 41 | internal var priority: ConstraintPriorityTarget = 1000.0 42 | internal lazy var constraint: Constraint? = { 43 | guard let relation = self.relation, 44 | let related = self.related, 45 | let sourceLocation = self.sourceLocation else { 46 | return nil 47 | } 48 | let from = ConstraintItem(target: self.item, attributes: self.attributes) 49 | 50 | return Constraint( 51 | from: from, 52 | to: related, 53 | relation: relation, 54 | sourceLocation: sourceLocation, 55 | label: self.label, 56 | multiplier: self.multiplier, 57 | constant: self.constant, 58 | priority: self.priority 59 | ) 60 | }() 61 | 62 | // MARK: Initialization 63 | 64 | internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) { 65 | self.item = item 66 | self.attributes = attributes 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintInsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintInsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintInsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintInsetTarget { 38 | } 39 | 40 | extension Float: ConstraintInsetTarget { 41 | } 42 | 43 | extension Double: ConstraintInsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintInsetTarget { 47 | } 48 | 49 | extension ConstraintInsets: ConstraintInsetTarget { 50 | } 51 | 52 | extension ConstraintInsetTarget { 53 | 54 | internal var constraintInsetTargetValue: ConstraintInsets { 55 | if let amount = self as? ConstraintInsets { 56 | return amount 57 | } else if let amount = self as? Float { 58 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 59 | } else if let amount = self as? Double { 60 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 61 | } else if let amount = self as? CGFloat { 62 | return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount) 63 | } else if let amount = self as? Int { 64 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 65 | } else if let amount = self as? UInt { 66 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 67 | } else { 68 | return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0) 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintInsets.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintInsets = UIEdgeInsets 33 | #else 34 | public typealias ConstraintInsets = NSEdgeInsets 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public final class ConstraintItem { 32 | 33 | internal weak var target: AnyObject? 34 | internal let attributes: ConstraintAttributes 35 | 36 | internal init(target: AnyObject?, attributes: ConstraintAttributes) { 37 | self.target = target 38 | self.attributes = attributes 39 | } 40 | 41 | internal var layoutConstraintItem: LayoutConstraintItem? { 42 | return self.target as? LayoutConstraintItem 43 | } 44 | 45 | } 46 | 47 | public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool { 48 | // pointer equality 49 | guard lhs !== rhs else { 50 | return true 51 | } 52 | 53 | // must both have valid targets and identical attributes 54 | guard let target1 = lhs.target, 55 | let target2 = rhs.target, 56 | target1 === target2 && lhs.attributes == rhs.attributes else { 57 | return false 58 | } 59 | 60 | return true 61 | } 62 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 9.0, OSX 10.11, *) 30 | public extension ConstraintLayoutGuide { 31 | 32 | public var snp: ConstraintLayoutGuideDSL { 33 | return ConstraintLayoutGuideDSL(guide: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuide.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 9.0, *) 33 | public typealias ConstraintLayoutGuide = UILayoutGuide 34 | #else 35 | @available(OSX 10.11, *) 36 | public typealias ConstraintLayoutGuide = NSLayoutGuide 37 | #endif 38 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 9.0, OSX 10.11, *) 32 | public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL { 33 | 34 | @discardableResult 35 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 36 | return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure) 37 | } 38 | 39 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 40 | ConstraintMaker.makeConstraints(item: self.guide, closure: closure) 41 | } 42 | 43 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 44 | ConstraintMaker.remakeConstraints(item: self.guide, closure: closure) 45 | } 46 | 47 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 48 | ConstraintMaker.updateConstraints(item: self.guide, closure: closure) 49 | } 50 | 51 | public func removeConstraints() { 52 | ConstraintMaker.removeConstraints(item: self.guide) 53 | } 54 | 55 | public var target: AnyObject? { 56 | return self.guide 57 | } 58 | 59 | internal let guide: ConstraintLayoutGuide 60 | 61 | internal init(guide: ConstraintLayoutGuide) { 62 | self.guide = guide 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 8.0, *) 33 | public typealias ConstraintLayoutSupport = UILayoutSupport 34 | #else 35 | public class ConstraintLayoutSupport {} 36 | #endif 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 8.0, *) 32 | public struct ConstraintLayoutSupportDSL: ConstraintDSL { 33 | 34 | public var target: AnyObject? { 35 | return self.support 36 | } 37 | 38 | internal let support: ConstraintLayoutSupport 39 | 40 | internal init(support: ConstraintLayoutSupport) { 41 | self.support = support 42 | 43 | } 44 | 45 | public var top: ConstraintItem { 46 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top) 47 | } 48 | 49 | public var bottom: ConstraintItem { 50 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom) 51 | } 52 | 53 | public var height: ConstraintItem { 54 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerEditable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerEditable: ConstraintMakerPriortizable { 32 | 33 | @discardableResult 34 | public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 35 | self.description.multiplier = amount 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 41 | return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue) 42 | } 43 | 44 | @discardableResult 45 | public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable { 46 | self.description.constant = amount.constraintOffsetTargetValue 47 | return self 48 | } 49 | 50 | @discardableResult 51 | public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable { 52 | self.description.constant = amount.constraintInsetTargetValue 53 | return self 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerFinalizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerFinalizable { 32 | 33 | internal let description: ConstraintDescription 34 | 35 | internal init(_ description: ConstraintDescription) { 36 | self.description = description 37 | } 38 | 39 | @discardableResult 40 | public func labeled(_ label: String) -> ConstraintMakerFinalizable { 41 | self.description.label = label 42 | return self 43 | } 44 | 45 | public var constraint: Constraint { 46 | return self.description.constraint! 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerPriortizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerPriortizable: ConstraintMakerFinalizable { 32 | 33 | @discardableResult 34 | public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable { 35 | self.description.priority = amount.value 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable { 41 | self.description.priority = amount 42 | return self 43 | } 44 | 45 | @available(*, deprecated:3.0, message:"Use priority(.required) instead.") 46 | @discardableResult 47 | public func priorityRequired() -> ConstraintMakerFinalizable { 48 | return self.priority(.required) 49 | } 50 | 51 | @available(*, deprecated:3.0, message:"Use priority(.high) instead.") 52 | @discardableResult 53 | public func priorityHigh() -> ConstraintMakerFinalizable { 54 | return self.priority(.high) 55 | } 56 | 57 | @available(*, deprecated:3.0, message:"Use priority(.medium) instead.") 58 | @discardableResult 59 | public func priorityMedium() -> ConstraintMakerFinalizable { 60 | return self.priority(.medium) 61 | } 62 | 63 | @available(*, deprecated:3.0, message:"Use priority(.low) instead.") 64 | @discardableResult 65 | public func priorityLow() -> ConstraintMakerFinalizable { 66 | return self.priority(.low) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMultiplierTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintMultiplierTarget { 32 | 33 | var constraintMultiplierTargetValue: CGFloat { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintMultiplierTarget { 38 | 39 | public var constraintMultiplierTargetValue: CGFloat { 40 | return CGFloat(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintMultiplierTarget { 46 | 47 | public var constraintMultiplierTargetValue: CGFloat { 48 | return CGFloat(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintMultiplierTarget { 54 | 55 | public var constraintMultiplierTargetValue: CGFloat { 56 | return CGFloat(self) 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintMultiplierTarget { 62 | 63 | public var constraintMultiplierTargetValue: CGFloat { 64 | return CGFloat(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintMultiplierTarget { 70 | 71 | public var constraintMultiplierTargetValue: CGFloat { 72 | return self 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintOffsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintOffsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintOffsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintOffsetTarget { 38 | } 39 | 40 | extension Float: ConstraintOffsetTarget { 41 | } 42 | 43 | extension Double: ConstraintOffsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintOffsetTarget { 47 | } 48 | 49 | extension ConstraintOffsetTarget { 50 | 51 | internal var constraintOffsetTargetValue: CGFloat { 52 | let offset: CGFloat 53 | if let amount = self as? Float { 54 | offset = CGFloat(amount) 55 | } else if let amount = self as? Double { 56 | offset = CGFloat(amount) 57 | } else if let amount = self as? CGFloat { 58 | offset = CGFloat(amount) 59 | } else if let amount = self as? Int { 60 | offset = CGFloat(amount) 61 | } else if let amount = self as? UInt { 62 | offset = CGFloat(amount) 63 | } else { 64 | offset = 0.0 65 | } 66 | return offset 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintPriority.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable { 31 | public typealias FloatLiteralType = Float 32 | 33 | public let value: Float 34 | 35 | public init(floatLiteral value: Float) { 36 | self.value = value 37 | } 38 | 39 | public init(_ value: Float) { 40 | self.value = value 41 | } 42 | 43 | public static var required: ConstraintPriority { 44 | return 1000.0 45 | } 46 | 47 | public static var high: ConstraintPriority { 48 | return 750.0 49 | } 50 | 51 | public static var medium: ConstraintPriority { 52 | #if os(OSX) 53 | return 501.0 54 | #else 55 | return 500.0 56 | #endif 57 | 58 | } 59 | 60 | public static var low: ConstraintPriority { 61 | return 250.0 62 | } 63 | 64 | public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool { 65 | return lhs.value == rhs.value 66 | } 67 | 68 | // MARK: Strideable 69 | 70 | public func advanced(by n: FloatLiteralType) -> ConstraintPriority { 71 | return ConstraintPriority(floatLiteral: value + n) 72 | } 73 | 74 | public func distance(to other: ConstraintPriority) -> FloatLiteralType { 75 | return other.value - value 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintPriorityTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintPriorityTarget { 32 | 33 | var constraintPriorityTargetValue: Float { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintPriorityTarget { 38 | 39 | public var constraintPriorityTargetValue: Float { 40 | return Float(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintPriorityTarget { 46 | 47 | public var constraintPriorityTargetValue: Float { 48 | return Float(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintPriorityTarget { 54 | 55 | public var constraintPriorityTargetValue: Float { 56 | return self 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintPriorityTarget { 62 | 63 | public var constraintPriorityTargetValue: Float { 64 | return Float(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintPriorityTarget { 70 | 71 | public var constraintPriorityTargetValue: Float { 72 | return Float(self) 73 | } 74 | 75 | } 76 | 77 | #if os(iOS) || os(tvOS) 78 | extension UILayoutPriority: ConstraintPriorityTarget { 79 | 80 | public var constraintPriorityTargetValue: Float { 81 | return self.rawValue 82 | } 83 | 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintRelatableTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintRelatableTarget { 32 | } 33 | 34 | extension Int: ConstraintRelatableTarget { 35 | } 36 | 37 | extension UInt: ConstraintRelatableTarget { 38 | } 39 | 40 | extension Float: ConstraintRelatableTarget { 41 | } 42 | 43 | extension Double: ConstraintRelatableTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintRelatableTarget { 47 | } 48 | 49 | extension CGSize: ConstraintRelatableTarget { 50 | } 51 | 52 | extension CGPoint: ConstraintRelatableTarget { 53 | } 54 | 55 | extension ConstraintInsets: ConstraintRelatableTarget { 56 | } 57 | 58 | extension ConstraintItem: ConstraintRelatableTarget { 59 | } 60 | 61 | extension ConstraintView: ConstraintRelatableTarget { 62 | } 63 | 64 | @available(iOS 9.0, OSX 10.11, *) 65 | extension ConstraintLayoutGuide: ConstraintRelatableTarget { 66 | } 67 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintRelation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | internal enum ConstraintRelation : Int { 32 | case equal = 1 33 | case lessThanOrEqual 34 | case greaterThanOrEqual 35 | 36 | internal var layoutRelation: LayoutRelation { 37 | get { 38 | switch(self) { 39 | case .equal: 40 | return .equal 41 | case .lessThanOrEqual: 42 | return .lessThanOrEqual 43 | case .greaterThanOrEqual: 44 | return .greaterThanOrEqual 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintView = UIView 33 | #else 34 | public typealias ConstraintView = NSView 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintViewDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public struct ConstraintViewDSL: ConstraintAttributesDSL { 32 | 33 | @discardableResult 34 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 35 | return ConstraintMaker.prepareConstraints(item: self.view, closure: closure) 36 | } 37 | 38 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 39 | ConstraintMaker.makeConstraints(item: self.view, closure: closure) 40 | } 41 | 42 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 43 | ConstraintMaker.remakeConstraints(item: self.view, closure: closure) 44 | } 45 | 46 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 47 | ConstraintMaker.updateConstraints(item: self.view, closure: closure) 48 | } 49 | 50 | public func removeConstraints() { 51 | ConstraintMaker.removeConstraints(item: self.view) 52 | } 53 | 54 | public var contentHuggingHorizontalPriority: Float { 55 | get { 56 | return self.view.contentHuggingPriority(for: .horizontal).rawValue 57 | } 58 | set { 59 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal) 60 | } 61 | } 62 | 63 | public var contentHuggingVerticalPriority: Float { 64 | get { 65 | return self.view.contentHuggingPriority(for: .vertical).rawValue 66 | } 67 | set { 68 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical) 69 | } 70 | } 71 | 72 | public var contentCompressionResistanceHorizontalPriority: Float { 73 | get { 74 | return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue 75 | } 76 | set { 77 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal) 78 | } 79 | } 80 | 81 | public var contentCompressionResistanceVerticalPriority: Float { 82 | get { 83 | return self.view.contentCompressionResistancePriority(for: .vertical).rawValue 84 | } 85 | set { 86 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical) 87 | } 88 | } 89 | 90 | public var target: AnyObject? { 91 | return self.view 92 | } 93 | 94 | internal let view: ConstraintView 95 | 96 | internal init(view: ConstraintView) { 97 | self.view = view 98 | 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/LayoutConstraint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class LayoutConstraint : NSLayoutConstraint { 32 | 33 | public var label: String? { 34 | get { 35 | return self.identifier 36 | } 37 | set { 38 | self.identifier = newValue 39 | } 40 | } 41 | 42 | internal weak var constraint: Constraint? = nil 43 | 44 | } 45 | 46 | internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool { 47 | guard lhs.firstItem === rhs.firstItem && 48 | lhs.secondItem === rhs.secondItem && 49 | lhs.firstAttribute == rhs.firstAttribute && 50 | lhs.secondAttribute == rhs.secondAttribute && 51 | lhs.relation == rhs.relation && 52 | lhs.priority == rhs.priority && 53 | lhs.multiplier == rhs.multiplier else { 54 | return false 55 | } 56 | return true 57 | } 58 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/LayoutConstraintItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol LayoutConstraintItem: class { 32 | } 33 | 34 | @available(iOS 9.0, OSX 10.11, *) 35 | extension ConstraintLayoutGuide : LayoutConstraintItem { 36 | } 37 | 38 | extension ConstraintView : LayoutConstraintItem { 39 | } 40 | 41 | 42 | extension LayoutConstraintItem { 43 | 44 | internal func prepare() { 45 | if let view = self as? ConstraintView { 46 | view.translatesAutoresizingMaskIntoConstraints = false 47 | } 48 | } 49 | 50 | internal var superview: ConstraintView? { 51 | if let view = self as? ConstraintView { 52 | return view.superview 53 | } 54 | 55 | if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide { 56 | return guide.owningView 57 | } 58 | 59 | return nil 60 | } 61 | internal var constraints: [Constraint] { 62 | return self.constraintsSet.allObjects as! [Constraint] 63 | } 64 | 65 | internal func add(constraints: [Constraint]) { 66 | let constraintsSet = self.constraintsSet 67 | for constraint in constraints { 68 | constraintsSet.add(constraint) 69 | } 70 | } 71 | 72 | internal func remove(constraints: [Constraint]) { 73 | let constraintsSet = self.constraintsSet 74 | for constraint in constraints { 75 | constraintsSet.remove(constraint) 76 | } 77 | } 78 | 79 | private var constraintsSet: NSMutableSet { 80 | let constraintsSet: NSMutableSet 81 | 82 | if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet { 83 | constraintsSet = existing 84 | } else { 85 | constraintsSet = NSMutableSet() 86 | objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 87 | } 88 | return constraintsSet 89 | 90 | } 91 | 92 | } 93 | private var constraintsKey: UInt8 = 0 94 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/Typealiases.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | import Foundation 25 | 26 | #if os(iOS) || os(tvOS) 27 | import UIKit 28 | #if swift(>=4.2) 29 | typealias LayoutRelation = NSLayoutConstraint.Relation 30 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 31 | #else 32 | typealias LayoutRelation = NSLayoutRelation 33 | typealias LayoutAttribute = NSLayoutAttribute 34 | #endif 35 | typealias LayoutPriority = UILayoutPriority 36 | #else 37 | import AppKit 38 | typealias LayoutRelation = NSLayoutConstraint.Relation 39 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 40 | typealias LayoutPriority = NSLayoutConstraint.Priority 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/UILayoutSupport+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 8.0, *) 30 | public extension ConstraintLayoutSupport { 31 | 32 | public var snp: ConstraintLayoutSupportDSL { 33 | return ConstraintLayoutSupportDSL(support: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-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 | 0.9.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_MBProgressHUD : NSObject 3 | @end 4 | @implementation PodsDummy_MBProgressHUD 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD-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/MBProgressHUD/MBProgressHUD-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 "MBProgressHUD.h" 14 | 15 | FOUNDATION_EXPORT double MBProgressHUDVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char MBProgressHUDVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD.modulemap: -------------------------------------------------------------------------------- 1 | framework module MBProgressHUD { 2 | umbrella header "MBProgressHUD-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/MBProgressHUD/MBProgressHUD.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" 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}/MBProgressHUD 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RichTextDemo/Pods-RichTextDemo-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-RichTextDemo/Pods-RichTextDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## MBProgressHUD 5 | 6 | Copyright (c) 2009-2015 Matej Bukovinski 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | ## SDWebImage 27 | 28 | Copyright (c) 2009-2017 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 | 50 | ## SnapKit 51 | 52 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 53 | 54 | Permission is hereby granted, free of charge, to any person obtaining a copy 55 | of this software and associated documentation files (the "Software"), to deal 56 | in the Software without restriction, including without limitation the rights 57 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 58 | copies of the Software, and to permit persons to whom the Software is 59 | furnished to do so, subject to the following conditions: 60 | 61 | The above copyright notice and this permission notice shall be included in 62 | all copies or substantial portions of the Software. 63 | 64 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 67 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 68 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 69 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 70 | THE SOFTWARE. 71 | 72 | Generated by CocoaPods - https://cocoapods.org 73 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RichTextDemo/Pods-RichTextDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RichTextDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RichTextDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RichTextDemo/Pods-RichTextDemo-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_RichTextDemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_RichTextDemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RichTextDemo/Pods-RichTextDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD/MBProgressHUD.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "ImageIO" -framework "MBProgressHUD" -framework "SDWebImage" -framework "SnapKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RichTextDemo/Pods-RichTextDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_RichTextDemo { 2 | umbrella header "Pods-RichTextDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-RichTextDemo/Pods-RichTextDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD/MBProgressHUD.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "ImageIO" -framework "MBProgressHUD" -framework "SDWebImage" -framework "SnapKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /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 | 4.4.3 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-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 "NSButton+WebCache.h" 14 | #import "NSData+ImageContentType.h" 15 | #import "NSImage+WebCache.h" 16 | #import "SDAnimatedImageRep.h" 17 | #import "SDImageCache.h" 18 | #import "SDImageCacheConfig.h" 19 | #import "SDWebImageCoder.h" 20 | #import "SDWebImageCoderHelper.h" 21 | #import "SDWebImageCodersManager.h" 22 | #import "SDWebImageCompat.h" 23 | #import "SDWebImageDownloader.h" 24 | #import "SDWebImageDownloaderOperation.h" 25 | #import "SDWebImageFrame.h" 26 | #import "SDWebImageGIFCoder.h" 27 | #import "SDWebImageImageIOCoder.h" 28 | #import "SDWebImageManager.h" 29 | #import "SDWebImageOperation.h" 30 | #import "SDWebImagePrefetcher.h" 31 | #import "SDWebImageTransition.h" 32 | #import "UIButton+WebCache.h" 33 | #import "UIImage+ForceDecode.h" 34 | #import "UIImage+GIF.h" 35 | #import "UIImage+MultiFormat.h" 36 | #import "UIImageView+HighlightedWebCache.h" 37 | #import "UIImageView+WebCache.h" 38 | #import "UIView+WebCache.h" 39 | #import "UIView+WebCacheOperation.h" 40 | 41 | FOUNDATION_EXPORT double SDWebImageVersionNumber; 42 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; 43 | 44 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SnapKit : NSObject 3 | @end 4 | @implementation PodsDummy_SnapKit 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-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/SnapKit/SnapKit-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 SnapKitVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit.modulemap: -------------------------------------------------------------------------------- 1 | framework module SnapKit { 2 | umbrella header "SnapKit-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 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}/SnapKit 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /RichTextDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RichTextDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RichTextDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RichTextDemo 4 | // 5 | // Created by Tiny on 2018/12/28. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /RichTextDemo/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 | } -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "circle_icon_thumbup_default.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "circle_icon_thumbup_default@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "circle_icon_thumbup_default@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/circle_icon_thumbup_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/circle_icon_thumbup_default.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/circle_icon_thumbup_default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/circle_icon_thumbup_default@2x.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/circle_icon_thumbup_default@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/circle_icon_thumbup_default.imageset/circle_icon_thumbup_default@3x.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "circle_icon_thumbup_elect.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "circle_icon_thumbup_elect@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "circle_icon_thumbup_elect@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/circle_icon_thumbup_elect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/circle_icon_thumbup_elect.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/circle_icon_thumbup_elect@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/circle_icon_thumbup_elect@2x.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/circle_icon_thumbup_elect@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/circle_icon_thumbup_select.imageset/circle_icon_thumbup_elect@3x.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/defaultavatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon-morentouxiang@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon-morentouxiang@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/defaultavatar.imageset/icon-morentouxiang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/defaultavatar.imageset/icon-morentouxiang@2x.png -------------------------------------------------------------------------------- /RichTextDemo/Assets.xcassets/defaultavatar.imageset/icon-morentouxiang@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/Assets.xcassets/defaultavatar.imageset/icon-morentouxiang@3x.png -------------------------------------------------------------------------------- /RichTextDemo/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 | -------------------------------------------------------------------------------- /RichTextDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKLoadingView/GKLoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKLoadingView.h 3 | // GKLoadingView 4 | // 5 | // Created by QuintGao on 2017/11/23. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GKPhotoBrowserConfigure.h" 11 | 12 | typedef NS_ENUM(NSUInteger, GKLoadingStyle) { 13 | GKLoadingStyleIndeterminate, // 不明确的加载方式 14 | GKLoadingStyleIndeterminateMask, // 不明确的加载方式带阴影 15 | GKLoadingStyleDeterminate // 明确的加载方式--进度条 16 | }; 17 | 18 | @interface GKLoadingView : UIView 19 | 20 | + (instancetype)loadingViewWithFrame:(CGRect)frame style:(GKLoadingStyle)style; 21 | 22 | @property (nonatomic, strong) UIButton *centerButton; 23 | 24 | /** 线条宽度:默认4 */ 25 | @property (nonatomic, assign) CGFloat lineWidth; 26 | 27 | /** 圆弧半径:默认24 */ 28 | @property (nonatomic, assign) CGFloat radius; 29 | 30 | /** 圆弧的背景颜色:默认半透明黑色 */ 31 | @property (nonatomic, strong) UIColor *bgColor; 32 | 33 | /** 进度的颜色:默认白色 */ 34 | @property (nonatomic, strong) UIColor *strokeColor; 35 | 36 | /** 进度,loadingStyle为GKLoadingStyleDeterminate时使用 */ 37 | @property (nonatomic, assign) CGFloat progress; 38 | 39 | @property (nonatomic, copy) void (^progressChange)(GKLoadingView *loadingView, CGFloat progress); 40 | 41 | @property (nonatomic, copy) void (^tapToReload)(void); 42 | 43 | /** 44 | 开始动画方法-loadingStyle为GKLoadingStyleIndeterminate,GKLoadingStyleIndeterminateMask时使用 45 | */ 46 | - (void)startLoading; 47 | 48 | /** 49 | 结束动画方法 50 | */ 51 | - (void)stopLoading; 52 | 53 | - (void)showFailure; 54 | 55 | - (void)hideLoadingView; 56 | 57 | - (void)removeAnimation; 58 | 59 | // 在duration时间内加载, 60 | - (void)startLoadingWithDuration:(NSTimeInterval)duration completion:(void (^)(GKLoadingView *loadingView, BOOL finished))completion; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhoto.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKPhoto.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/10/20. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GKWebImageProtocol.h" 11 | #import "GKPhotoBrowserConfigure.h" 12 | 13 | @interface GKPhoto : NSObject 14 | 15 | /** 图片地址 */ 16 | @property (nonatomic, strong) NSURL *url; 17 | 18 | /** 来源imageView */ 19 | @property (nonatomic, strong) UIImageView *sourceImageView; 20 | 21 | /** 来源frame */ 22 | @property (nonatomic, assign) CGRect sourceFrame; 23 | 24 | /** 图片(静态) */ 25 | @property (nonatomic, strong) UIImage *image; 26 | 27 | /** gif图片 */ 28 | @property (nonatomic, strong) UIImage *gifImage; 29 | @property (nonatomic, strong) NSData *gifData; 30 | @property (nonatomic, assign) BOOL isGif; 31 | 32 | // imageView对象 33 | @property (nonatomic, strong) UIImageView *imageView; 34 | 35 | /** 占位图 */ 36 | @property (nonatomic, strong) UIImage *placeholderImage; 37 | 38 | /** 图片是否加载完成 */ 39 | @property (nonatomic, assign) BOOL finished; 40 | /** 图片是否加载失败 */ 41 | @property (nonatomic, assign) BOOL failed; 42 | 43 | /** 记录photoView是否缩放 */ 44 | @property (nonatomic, assign) BOOL isZooming; 45 | 46 | /** 记录photoView缩放时的rect */ 47 | @property (nonatomic, assign) CGRect zoomRect; 48 | 49 | - (void)startAnimation; 50 | - (void)stopAnimation; 51 | 52 | @end 53 | 54 | @interface GKPhotoDecoder : NSOperation 55 | 56 | @property (nonatomic, assign) NSUInteger nextIndex; 57 | @property (nonatomic, strong) UIImage *curImage; 58 | @property (nonatomic, weak) dispatch_semaphore_t lock; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.bundle/angle-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.bundle/angle-mask.png -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.bundle/angle-mask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.bundle/angle-mask@2x.png -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.bundle/angle-mask@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.bundle/angle-mask@3x.png -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhotoBrowser.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKPhotoBrowser.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/10/20. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GKPhotoView.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | // 判断iPhone X 15 | #define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ?\ 16 | (\ 17 | CGSizeEqualToSize(CGSizeMake(375, 812),[UIScreen mainScreen].bounds.size)\ 18 | ||\ 19 | CGSizeEqualToSize(CGSizeMake(812, 375),[UIScreen mainScreen].bounds.size)\ 20 | ||\ 21 | CGSizeEqualToSize(CGSizeMake(414, 896),[UIScreen mainScreen].bounds.size)\ 22 | ||\ 23 | CGSizeEqualToSize(CGSizeMake(896, 414),[UIScreen mainScreen].bounds.size))\ 24 | :\ 25 | NO) 26 | #define kSaveTopSpace (KIsiPhoneX ? 24.0f : 0) // iPhone X顶部多出的距离(刘海) 27 | #define kSaveBottomSpace (KIsiPhoneX ? 34.0f : 0) // iPhone X底部多出的距离 28 | 29 | @class GKPhotoBrowser; 30 | 31 | typedef void(^layoutBlock)(GKPhotoBrowser *photoBrowser, CGRect superFrame); 32 | 33 | @protocol GKPhotoBrowserDelegate 34 | 35 | @optional 36 | 37 | // 滚动到一半时索引改变 38 | - (void)photoBrowser:(GKPhotoBrowser *)browser didChangedIndex:(NSInteger)index; 39 | 40 | // 滚动结束时索引改变 41 | - (void)photoBrowser:(GKPhotoBrowser *)browser scrollEndedIndex:(NSInteger)index; 42 | 43 | // 单击事件 44 | - (void)photoBrowser:(GKPhotoBrowser *)browser singleTapWithIndex:(NSInteger)index; 45 | 46 | // 长按事件 47 | - (void)photoBrowser:(GKPhotoBrowser *)browser longPressWithIndex:(NSInteger)index; 48 | 49 | // 旋转事件 50 | - (void)photoBrowser:(GKPhotoBrowser *)browser onDeciceChangedWithIndex:(NSInteger)index isLandspace:(BOOL)isLandspace; 51 | 52 | // 上下滑动消失 53 | // 开始滑动时 54 | - (void)photoBrowser:(GKPhotoBrowser *)browser panBeginWithIndex:(NSInteger)index; 55 | 56 | // 结束滑动时 disappear:是否消失 57 | - (void)photoBrowser:(GKPhotoBrowser *)browser panEndedWithIndex:(NSInteger)index willDisappear:(BOOL)disappear; 58 | 59 | // 布局子视图 60 | - (void)photoBrowser:(GKPhotoBrowser *)browser willLayoutSubViews:(NSInteger)index; 61 | 62 | @end 63 | 64 | @interface GKPhotoBrowser : UIViewController 65 | 66 | /** 底部内容试图 */ 67 | @property (nonatomic, strong, readonly) UIView *contentView; 68 | /** 图片模型数组 */ 69 | @property (nonatomic, strong, readonly) NSArray *photos; 70 | /** 当前索引 */ 71 | @property (nonatomic, assign, readonly) NSInteger currentIndex; 72 | /** 当前选中的image */ 73 | @property (nonatomic, assign, readonly) UIImage *currentImage; 74 | 75 | /** 是否是横屏 */ 76 | @property (nonatomic, assign, readonly) BOOL isLandspace; 77 | /** 当前设备的方向 */ 78 | @property (nonatomic, assign, readonly) UIDeviceOrientation currentOrientation; 79 | /** 显示方式 */ 80 | @property (nonatomic, assign) GKPhotoBrowserShowStyle showStyle; 81 | /** 隐藏方式 */ 82 | @property (nonatomic, assign) GKPhotoBrowserHideStyle hideStyle; 83 | /** 图片加载方式 */ 84 | @property (nonatomic, assign) GKPhotoBrowserLoadStyle loadStyle; 85 | /** 代理 */ 86 | @property (nonatomic, weak) id delegate; 87 | 88 | /** 是否禁止屏幕旋转监测 */ 89 | @property (nonatomic, assign) BOOL isScreenRotateDisabled; 90 | 91 | /** 是否禁用默认单击事件 */ 92 | @property (nonatomic, assign) BOOL isSingleTapDisabled; 93 | 94 | /** 是否显示状态栏,默认NO:不显示状态栏 */ 95 | @property (nonatomic, assign) BOOL isStatusBarShow; 96 | 97 | /** 滑动消失时是否隐藏原来的视图:默认YES */ 98 | @property (nonatomic, assign) BOOL isHideSourceView; 99 | 100 | /** 滑动切换图片时,是否恢复上(下)一张图片的缩放程度,默认是NO */ 101 | @property (nonatomic, assign) BOOL isResumePhotoZoom; 102 | 103 | /** 横屏时是否充满屏幕宽度,默认YES,为NO时图片自动填充屏幕 */ 104 | @property (nonatomic, assign) BOOL isFullWidthForLandSpace; 105 | 106 | /** 是否适配安全区域,默认NO,为YES时图片会自动适配iPhone X的安全区域 */ 107 | @property (nonatomic, assign) BOOL isAdaptiveSaveArea; 108 | 109 | /** 110 | 开启这个选项后 在加载gif的时候 会大大的降低内存.与YYImage对gif的内存优化思路一样 default is NO 111 | */ 112 | @property (nonatomic, assign) BOOL isLowGifMemory; 113 | 114 | /** 浏览器背景(默认黑色) */ 115 | @property (nonatomic, strong) UIColor *bgColor; 116 | 117 | // 初始化方法 118 | 119 | /** 120 | 创建图片浏览器 121 | 122 | @param photos 包含GKPhoto对象的数组 123 | @param currentIndex 当前的页码 124 | @return 图片浏览器对象 125 | */ 126 | + (instancetype)photoBrowserWithPhotos:(NSArray *)photos currentIndex:(NSInteger)currentIndex; 127 | 128 | - (instancetype)initWithPhotos:(NSArray *)photos currentIndex:(NSInteger)currentIndex; 129 | 130 | /** 131 | 为浏览器添加自定义遮罩视图 132 | 133 | @param coverViews 视图数组 134 | @param layoutBlock 布局 135 | */ 136 | - (void)setupCoverViews:(NSArray *)coverViews layoutBlock:(layoutBlock)layoutBlock; 137 | 138 | /** 139 | 显示图片浏览器 140 | 141 | @param vc 控制器 142 | */ 143 | - (void)showFromVC:(UIViewController *)vc; 144 | 145 | /** 146 | 移除指定位置的内容 147 | 148 | @param index 位置索引 149 | */ 150 | - (void)removePhotoAtIndex:(NSInteger)index; 151 | 152 | /** 153 | 重置图片浏览器 154 | 155 | @param photos 图片内容数组 156 | */ 157 | - (void)resetPhotoBrowserWithPhotos:(NSArray *)photos; 158 | 159 | + (void)setImageManagerClass:(Class)cls; 160 | 161 | @end 162 | 163 | NS_ASSUME_NONNULL_END 164 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhotoBrowserConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKPhotoBrowserConfigure.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/10/23. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #ifndef GKPhotoBrowserConfigure_h 10 | #define GKPhotoBrowserConfigure_h 11 | 12 | #import "UIImage+GKDecoder.h" 13 | #import "UIScrollView+GKGestureHandle.h" 14 | #import 15 | #import 16 | #import 17 | 18 | #define GKScreenW [UIScreen mainScreen].bounds.size.width 19 | #define GKScreenH [UIScreen mainScreen].bounds.size.height 20 | 21 | #define kMaxZoomScale 2.0f 22 | 23 | #define kPhotoViewPadding 10 24 | 25 | #define kAnimationDuration 0.25f 26 | 27 | #define LOCK(...) dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \ 28 | __VA_ARGS__; \ 29 | dispatch_semaphore_signal(_lock); 30 | 31 | #define GKPhotoBrowserSrcName(file) [@"GKPhotoBrowser.bundle" stringByAppendingPathComponent:file] 32 | 33 | #define GKPhotoBrowserFrameworkSrcName(file) [@"Frameworks/GKPhotoBrowser.framework/GKPhotoBrowser.bundle" stringByAppendingPathComponent:file] 34 | 35 | #define GKPhotoBrowserImage(file) [UIImage imageNamed:GKPhotoBrowserSrcName(file)] ? : [UIImage imageNamed:GKPhotoBrowserFrameworkSrcName(file)] 36 | 37 | // 图片浏览器的显示方式 38 | typedef NS_ENUM(NSUInteger, GKPhotoBrowserShowStyle) { 39 | GKPhotoBrowserShowStyleNone, // 直接显示,默认方式 40 | GKPhotoBrowserShowStyleZoom, // 缩放显示,动画效果 41 | GKPhotoBrowserShowStylePush // push方式展示 42 | }; 43 | 44 | // 图片浏览器的隐藏方式 45 | typedef NS_ENUM(NSUInteger, GKPhotoBrowserHideStyle) { 46 | GKPhotoBrowserHideStyleZoom, // 点击缩放消失 47 | GKPhotoBrowserHideStyleZoomScale, // 点击缩放消失、滑动缩小后消失 48 | GKPhotoBrowserHideStyleZoomSlide // 点击缩放消失、滑动平移后消失 49 | }; 50 | 51 | // 图片浏览器的加载方式 52 | typedef NS_ENUM(NSUInteger, GKPhotoBrowserLoadStyle) { 53 | GKPhotoBrowserLoadStyleIndeterminate, // 不明确的加载方式 54 | GKPhotoBrowserLoadStyleIndeterminateMask, // 不明确的加载方式带阴影 55 | GKPhotoBrowserLoadStyleDeterminate // 明确的加载方式带进度条 56 | }; 57 | 58 | #endif /* GKPhotoBrowserConfigure_h */ 59 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKPhotoView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKPhotoView.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/10/23. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GKPhoto.h" 11 | #import "GKScrollView.h" 12 | #import "GKWebImageProtocol.h" 13 | #import "GKLoadingView.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @class GKPhotoView; 18 | 19 | @interface GKPhotoView : UIView 20 | 21 | @property (nonatomic, strong, readonly) GKScrollView *scrollView; 22 | 23 | @property (nonatomic, strong, readonly) UIImageView *imageView; 24 | 25 | @property (nonatomic, strong, readonly) GKLoadingView *loadingView; 26 | 27 | @property (nonatomic, strong, readonly) GKPhoto *photo; 28 | 29 | @property (nonatomic, copy) void(^zoomEnded)(NSInteger scale); 30 | 31 | /** 横屏时是否充满屏幕宽度,默认YES,为NO时图片自动填充屏幕 */ 32 | @property (nonatomic, assign) BOOL isFullWidthForLandSpace; 33 | 34 | /** 35 | 开启这个选项后 在加载gif的时候 会大大的降低内存.与YYImage对gif的内存优化思路一样 default is NO 36 | */ 37 | @property (nonatomic, assign) BOOL isLowGifMemory; 38 | 39 | /** 是否重新布局 */ 40 | @property (nonatomic, assign) BOOL isLayoutSubViews; 41 | 42 | @property (nonatomic, assign) GKPhotoBrowserLoadStyle loadStyle; 43 | 44 | - (instancetype)initWithFrame:(CGRect)frame imageProtocol:(id)imageProtocol; 45 | 46 | // 设置数据 47 | - (void)setupPhoto:(GKPhoto *)photo; 48 | 49 | - (void)adjustFrame; 50 | 51 | // 缩放 52 | - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; 53 | 54 | // 重新布局 55 | - (void)resetFrame; 56 | 57 | - (void)startGifAnimation; 58 | - (void)stopGifAnimation; 59 | 60 | @end 61 | 62 | NS_ASSUME_NONNULL_END 63 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKScrollView.h 3 | // GKPhotoBrowserDemo 4 | // 5 | // Created by gaokun on 2018/8/20. 6 | // Copyright © 2018年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GKScrollView : UIScrollView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GKScrollView.m 3 | // GKPhotoBrowserDemo 4 | // 5 | // Created by gaokun on 2018/8/20. 6 | // Copyright © 2018年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import "GKScrollView.h" 10 | 11 | @implementation GKScrollView 12 | 13 | #pragma mark - UIGestureRecognizerDelegate 14 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 15 | 16 | if (gestureRecognizer == self.panGestureRecognizer) { 17 | if (gestureRecognizer.state == UIGestureRecognizerStatePossible) { 18 | if ([self isScrollViewOnTopOrBottom]) { 19 | return NO; 20 | } 21 | } 22 | } 23 | 24 | return YES; 25 | } 26 | 27 | // 判断是否滑动到顶部或底部 28 | - (BOOL)isScrollViewOnTopOrBottom { 29 | CGPoint translation = [self.panGestureRecognizer translationInView:self]; 30 | if (translation.y > 0 && self.contentOffset.y <= 0) { 31 | return YES; 32 | } 33 | CGFloat maxOffsetY = floor(self.contentSize.height - self.bounds.size.height); 34 | if (translation.y < 0 && self.contentOffset.y >= maxOffsetY) { 35 | return YES; 36 | } 37 | return NO; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKWebImageManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKWebImageManager.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/11/14. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GKPhotoBrowserConfigure.h" 11 | #import "GKWebImageProtocol.h" 12 | 13 | @interface GKWebImageManager : NSObject 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKWebImageManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // GKWebImageManager.m 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/11/14. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import "GKWebImageManager.h" 10 | 11 | @implementation GKWebImageManager 12 | 13 | - (id)loadImageWithURL:(NSURL *)url progress:(gkWebImageProgressBlock)progress completed:(gkWebImageCompletionBlock)completion { 14 | // 进度block 15 | SDWebImageDownloaderProgressBlock progressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL *targetURL) { 16 | !progress ? : progress(receivedSize, expectedSize); 17 | }; 18 | 19 | // 图片加载完成block 20 | SDInternalCompletionBlock completionBlock = ^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { 21 | !completion ? : completion(image, data, error, cacheType, finished, imageURL); 22 | }; 23 | 24 | return [[SDWebImageManager sharedManager] loadImageWithURL:url options:SDWebImageRetryFailed progress:progressBlock completed:completionBlock]; 25 | } 26 | 27 | - (void)cancelImageRequestWithImageView:(UIImageView *)imageView { 28 | [imageView sd_cancelCurrentImageLoad]; 29 | } 30 | 31 | - (UIImage *)imageFromMemoryForURL:(NSURL *)url { 32 | SDWebImageManager *manager = [SDWebImageManager sharedManager]; 33 | NSString *key = [manager cacheKeyForURL:url]; 34 | return [manager.imageCache imageFromCacheForKey:key]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/GKWebImageProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKWebImageProtocol.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/11/14. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import "GKPhotoBrowserConfigure.h" 10 | 11 | typedef void (^gkWebImageProgressBlock)(NSInteger receivedSize, NSInteger expectedSize); 12 | 13 | typedef void (^gkWebImageCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL); 14 | 15 | @protocol GKWebImageProtocol 16 | 17 | // 加载图片 18 | - (id)loadImageWithURL:(nullable NSURL *)url 19 | progress:(nullable gkWebImageProgressBlock)progress 20 | completed:(nullable gkWebImageCompletionBlock)completion; 21 | 22 | - (void)cancelImageRequestWithImageView:(nullable UIImageView *)imageView; 23 | 24 | - (UIImage *_Nullable)imageFromMemoryForURL:(nullable NSURL *)url; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/UIImage+GKDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GKDecoder.h 3 | // GKPhotoBrowserDemo 4 | // 5 | // Created by gaokun on 2018/8/6. 6 | // Copyright © 2018年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GKDecoder) 12 | 13 | // 存储图片 14 | @property (nonatomic, setter=gk_setImageBuffer:,getter=gk_imageBuffer) NSMutableDictionary *buffer; 15 | 16 | // 是否需要不停刷新buffer 17 | @property (nonatomic, setter=gk_setNeedUpdateBuffer:,getter=gk_needUpdateBuffer) NSNumber *needUpdateBuffer; 18 | 19 | // 当前展示到哪一张图片了 20 | @property (nonatomic, setter=gk_setHandleIndex:,getter=gk_handleIndex) NSNumber *handleIndex; 21 | 22 | // 最大的缓存图片数 23 | @property (nonatomic, setter=gk_setMaxBufferCount:,getter=gk_maxBufferCount) NSNumber *maxBufferCount; 24 | 25 | // 当前这帧图像是否展示 26 | @property (nonatomic, setter=gk_setBufferMiss:,getter=gk_bufferMiss) NSNumber *bufferMiss; 27 | 28 | // 增加的buffer数目 29 | @property (nonatomic, setter=gk_setIncrBufferCount:,getter=gk_incrBufferCount) NSNumber *incrBufferCount; 30 | 31 | // 该gif 一共多少帧 32 | @property (nonatomic, setter=gk_setTotalFrameCount:,getter=gk_totalFrameCount) NSNumber *totalFrameCount; 33 | 34 | + (UIImage *)sdOverdue_animatedGIFWithData:(NSData *)data; 35 | 36 | - (void)gk_animatedGIFData:(NSData *)data; 37 | 38 | - (NSTimeInterval)animatedImageDurationAtIndex:(int)index; 39 | 40 | - (UIImage *)animatedImageFrameAtIndex:(int)index; 41 | 42 | - (void)imageViewShowFinished; 43 | 44 | @end 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/UIScrollView+GKGestureHandle.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+GKGestureHandle.h 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/11/10. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIScrollView (GKGestureHandle) 12 | 13 | /** 14 | 是否禁用手势处理 15 | */ 16 | @property (nonatomic, assign) BOOL gk_gestureHandleDisabled; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /RichTextDemo/GKPhotoBrowser/UIScrollView+GKGestureHandle.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+GKGestureHandle.m 3 | // GKPhotoBrowser 4 | // 5 | // Created by QuintGao on 2017/11/10. 6 | // Copyright © 2017年 QuintGao. All rights reserved. 7 | // 8 | 9 | #import "UIScrollView+GKGestureHandle.h" 10 | #import 11 | 12 | static const void* GKGestureHandleDisabled = @"GKGestureHandleDisabled"; 13 | 14 | @implementation UIScrollView (GKGestureHandle) 15 | 16 | - (void)setGk_gestureHandleDisabled:(BOOL)gk_gestureHandleDisabled { 17 | objc_setAssociatedObject(self, GKGestureHandleDisabled, @(gk_gestureHandleDisabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 18 | } 19 | 20 | - (BOOL)gk_gestureHandleDisabled { 21 | return [objc_getAssociatedObject(self, GKGestureHandleDisabled) boolValue]; 22 | } 23 | 24 | #pragma mark - 解决全屏滑动 25 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 26 | 27 | if (self.gk_gestureHandleDisabled) return YES; 28 | 29 | if ([self panBack:gestureRecognizer]) return NO; 30 | 31 | return YES; 32 | } 33 | 34 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { 35 | 36 | if (self.gk_gestureHandleDisabled) return NO; 37 | 38 | if ([self panBack:gestureRecognizer]) return YES; 39 | 40 | return NO; 41 | } 42 | 43 | - (BOOL)panBack:(UIGestureRecognizer *)gestureRecognizer { 44 | if (gestureRecognizer == self.panGestureRecognizer) { 45 | CGPoint point = [self.panGestureRecognizer translationInView:self]; 46 | UIGestureRecognizerState state = gestureRecognizer.state; 47 | 48 | // 设置手势滑动的位置距屏幕左边的区域 49 | CGFloat locationDistance = [UIScreen mainScreen].bounds.size.width; 50 | 51 | if (state == UIGestureRecognizerStateBegan || state == UIGestureRecognizerStatePossible) { 52 | CGPoint location = [gestureRecognizer locationInView:self]; 53 | if (point.x > 0 && location.x < locationDistance && self.contentOffset.x <= 0) { 54 | return YES; 55 | } 56 | } 57 | } 58 | return NO; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /RichTextDemo/HXQButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HXQButton.swift 3 | // hxquan-swift 4 | // 5 | // Created by Tiny on 2018/11/29. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HXQButton: UIButton { 12 | 13 | var buttonClickBlock: ((HXQButton)->Void)? 14 | 15 | /// 快速创建UIButton 16 | convenience init(title: String = "", 17 | color: UIColor = .black, 18 | font: UIFont = UIFont.systemFont(ofSize: 14), 19 | didClick:((HXQButton)->Void)? = nil) { 20 | self.init() 21 | self.setTitle(title, for: .normal) 22 | self.setTitleColor(color, for: .normal) 23 | self.titleLabel?.font = font 24 | buttonClickBlock = didClick 25 | if didClick != nil { 26 | self.addTarget(self, action: #selector(buttonClick(_:)), for: .touchUpInside) 27 | } 28 | } 29 | 30 | @objc func buttonClick(_ item: HXQButton){ 31 | buttonClickBlock?(item) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /RichTextDemo/HXQLabel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HXQLabel.swift 3 | // hxquan-swift 4 | // 5 | // Created by Tiny on 2018/11/29. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HXQLabel: UILabel { 12 | 13 | var labelTapBlock: (() ->Void)? 14 | 15 | /// 快速创建 16 | convenience init(text: String = "", 17 | color: UIColor = .black, 18 | font: UIFont = .systemFont(ofSize: 14), 19 | alignment: NSTextAlignment = .left, 20 | lines: Int = 1, 21 | didTap: (() ->Void)? = nil) { 22 | self.init() 23 | self.text = text 24 | self.font = font 25 | self.textAlignment = alignment 26 | self.textColor = color 27 | self.numberOfLines = lines 28 | self.labelTapBlock = didTap 29 | if didTap != nil { 30 | self.isUserInteractionEnabled = true 31 | let tapGesture = UITapGestureRecognizer(target: self, action: #selector(LabelTap(_:))) 32 | self.addGestureRecognizer(tapGesture) 33 | } 34 | } 35 | 36 | @objc func LabelTap(_ tap: UIGestureRecognizer){ 37 | labelTapBlock?() 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /RichTextDemo/HXQView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HXQView.swift 3 | // hxquan-swift 4 | // 5 | // Created by Tiny on 2018/11/29. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HXQView: UIView { 12 | 13 | override init(frame: CGRect) { 14 | super.init(frame: frame) 15 | setupUI() 16 | } 17 | 18 | required init?(coder aDecoder: NSCoder) { 19 | super.init(coder: aDecoder) 20 | } 21 | 22 | func setupUI(){ 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /RichTextDemo/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 | NSAppTransportSecurity 45 | 46 | NSAllowsArbitraryLoads 47 | 48 | 49 | NSCameraUsageDescription 50 | 访问相机 51 | NSMicrophoneUsageDescription 52 | 访问录音权限 53 | NSPhotoLibraryAddUsageDescription 54 | 保存图片 55 | NSPhotoLibraryUsageDescription 56 | 访问图片 57 | 58 | 59 | -------------------------------------------------------------------------------- /RichTextDemo/LoadingView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LoadingView.swift 3 | // RichTextDemo 4 | // 5 | // Created by Tiny on 2018/12/28. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class LoadingView: UIView { 12 | 13 | lazy var label: HXQLabel = { 14 | let label = HXQLabel(text: "别着急,正在加载中...", color: UIColor.gray) 15 | return label 16 | }() 17 | 18 | lazy var indicatorView: UIActivityIndicatorView = { 19 | let indicatorView = UIActivityIndicatorView(style: .gray) 20 | return indicatorView 21 | }() 22 | 23 | override init(frame: CGRect) { 24 | super.init(frame: frame) 25 | setupUI() 26 | } 27 | 28 | required init?(coder aDecoder: NSCoder) { 29 | super.init(coder: aDecoder) 30 | } 31 | 32 | private func setupUI(){ 33 | backgroundColor = .white 34 | 35 | addSubview(label) 36 | addSubview(indicatorView) 37 | 38 | indicatorView.snp.makeConstraints { (make) in 39 | make.centerX.equalToSuperview() 40 | make.centerY.equalToSuperview().offset(-20) 41 | } 42 | label.snp.makeConstraints { (make) in 43 | make.centerX.equalToSuperview() 44 | make.top.equalTo(indicatorView.snp.bottom).offset(20) 45 | } 46 | 47 | indicatorView.startAnimating() 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD+FastKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MBProgressHUD+FastKit.swift 3 | // t1 4 | // 5 | // Created by Tiny on 2018/10/24. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import MBProgressHUD 11 | 12 | extension MBProgressHUD { 13 | 14 | /// MBProgressHUD gif显示 15 | /// 16 | /// - Parameters: 17 | /// - view: view default -> UIWindow 18 | /// - disableInteraction: 是否使能交互 19 | /// - animated: 动画 true 20 | static func showGif(to view:UIView? = nil,disableInteraction:Bool = true,animated:Bool = true){ 21 | //如果是gif可以使用sdwebImage的方法加载本地gif 22 | let path = Bundle.main.path(forResource: "test", ofType: "gif") 23 | let data = NSData(contentsOfFile: path ?? "") as Data? 24 | guard let image = UIImage.sd_animatedGIF(with: data) else{ 25 | fatalError("gif图片加载失败"); 26 | } 27 | let giftImgView = UIImageView(image: image) 28 | let hud = MBProgressHUD.showHudAdded(to: view, animated: animated) 29 | hud?.color = .clear 30 | hud?.mode = .customView 31 | hud?.isUserInteractionEnabled = disableInteraction 32 | hud?.customView = giftImgView 33 | } 34 | 35 | /// 拓展MBProgressHUD显示方法 36 | /// 37 | /// - Parameters: 38 | /// - message: text 39 | /// - icon: picture 40 | /// - view: view default->UIwindow 41 | /// - disableInteraction: 是否使能交互 42 | /// - afterDelay: 延时 默认0 43 | /// - animated: 动画 true 44 | static func show(message:String? = nil , 45 | icon:String? = nil , 46 | to view:UIView? = nil, 47 | disableInteraction:Bool = true, 48 | afterDelay:TimeInterval = 0, 49 | animated:Bool = true){ 50 | 51 | let hud = self.showHudAdded(to: view, animated: true) 52 | hud?.isUserInteractionEnabled = disableInteraction 53 | hud?.labelText = message 54 | if let image = UIImage(named: "MBProgressHUD.bundle/\(icon ?? "")") { 55 | let imgView = UIImageView(image: image) 56 | hud?.customView = imgView 57 | hud?.mode = .customView 58 | } 59 | if afterDelay > 0.0 { 60 | hud?.hide(true, afterDelay: afterDelay) 61 | } 62 | } 63 | 64 | /// 移除keywindow的hud 65 | static func hide(){ 66 | let v = UIApplication.shared.windows.last; 67 | hide(for: v, animated: true) 68 | } 69 | 70 | static func showSuccess(_ message:String = "",to view:UIView? = nil){ 71 | show(message: message, icon: "success.png", to: view ,afterDelay: 2.0) 72 | } 73 | 74 | static func showError(_ message:String = "",to view:UIView? = nil){ 75 | show(message: message, icon: "error.png", to: view ,afterDelay: 2.0) 76 | } 77 | 78 | private static func showHudAdded(to view:UIView? = nil,animated:Bool = true) -> MBProgressHUD?{ 79 | var v = view 80 | if v == nil { 81 | v = UIApplication.shared.windows.last; 82 | } 83 | hide(for: v, animated: true) 84 | let hud = MBProgressHUD.showAdded(to: v, animated: animated); 85 | hud?.dimBackground = false 86 | hud?.removeFromSuperViewOnHide = true 87 | return hud 88 | 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/MBProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/MBProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD.bundle/error@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/MBProgressHUD.bundle/error@3x.png -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/MBProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/MBProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /RichTextDemo/MBProgressHUD.bundle/success@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qqcc1388/RichTextDemo/e5c0913b9143697150194c6cb8879837690a538a/RichTextDemo/MBProgressHUD.bundle/success@3x.png -------------------------------------------------------------------------------- /RichTextDemo/RichTextDemo1VC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RichTextDemo1VC.swift 3 | // RichTextDemo 4 | // 5 | // Created by Tiny on 2018/12/28. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class RichTextDemo1VC: UIViewController{ 12 | 13 | var html: String! 14 | 15 | var loadingView: LoadingView = { 16 | let loadingView = LoadingView() 17 | return loadingView 18 | }() 19 | 20 | override func viewDidLoad() { 21 | 22 | super.viewDidLoad() 23 | 24 | view.backgroundColor = .white 25 | 26 | html = "

\"迪丽热巴banner没有LOGO.jpg\"/

在2018年农历新年来临之际

火星圈&Dear迪丽热巴后援会相约深圳进行春节探访

活动现场捐赠了制氧机、助行器、北京老布鞋、手绢套装等急需且贴心的物资和礼物;

和老人们在一起聊天、活动度过了愉快的时光

阿达飞奔来送上图片集锦~~

\"6.jpg\"/

\"1.jpg\"/

\"2.jpg\"/

\"3.jpg\"/

\"4.jpg\"/

\"5.jpg\"/




\"可爱.png\"/

" 27 | 28 | demo1() 29 | } 30 | 31 | private func demo1(){ 32 | //第一种情况 全覆盖 富文本占满整个屏幕 33 | /// 加载网页 34 | 35 | let richTextView = RichTextView(frame: view.bounds, fromVC: self) 36 | view.addSubview(richTextView) 37 | richTextView.webHeight = {[unowned self] height in 38 | self.loadingView .removeFromSuperview() 39 | } 40 | 41 | richTextView.snp.makeConstraints { (make) in 42 | make.edges.equalToSuperview() 43 | } 44 | richTextView.richText = html 45 | 46 | //加载loadingView 47 | view.addSubview(loadingView) 48 | loadingView.snp.makeConstraints { (make) in 49 | make.edges.equalToSuperview() 50 | } 51 | } 52 | 53 | deinit { 54 | print("RichTextDemo1VC dealloc") 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /RichTextDemo/RichTextDemo3VC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RichTextDemo3VC.swift 3 | // RichTextDemo 4 | // 5 | // Created by Tiny on 2018/12/28. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class RichTextDemo3VC: UIViewController{ 12 | 13 | var html: String! 14 | 15 | var webHeight: CGFloat = 0 16 | 17 | lazy var tableView: UITableView = { 18 | let tableView = UITableView(frame: .zero, style: .plain) 19 | tableView.showsVerticalScrollIndicator = false 20 | tableView.showsHorizontalScrollIndicator = false 21 | tableView.delegate = self 22 | tableView.dataSource = self 23 | if #available(iOS 11.0, *) { 24 | tableView.contentInsetAdjustmentBehavior = .never 25 | } 26 | tableView.estimatedSectionHeaderHeight = 0 27 | tableView.estimatedSectionFooterHeight = 0 28 | 29 | tableView.tableFooterView = UIView() 30 | 31 | tableView.rowHeight = UITableView.automaticDimension; 32 | tableView.estimatedRowHeight = 44; 33 | return tableView 34 | }() 35 | 36 | lazy var headerView: RichTextHeaderView = { 37 | let header = RichTextHeaderView(frame: .zero, fromVC: self) 38 | header.headerHeight = { [unowned self] height in 39 | //重新设置headerHeight 40 | 41 | self.headerView.height = height 42 | //注意这里一定要重新设置一次tableHeaderView 43 | self.tableView.tableHeaderView = self.headerView 44 | self.loadingView.removeFromSuperview() 45 | } 46 | return header 47 | }() 48 | 49 | private var loadingView: LoadingView = { 50 | let loadingView = LoadingView() 51 | return loadingView 52 | }() 53 | 54 | override func viewDidLoad() { 55 | super.viewDidLoad() 56 | 57 | view.backgroundColor = .white 58 | 59 | //设置UI 60 | view.addSubview(tableView) 61 | tableView.snp.makeConstraints { (make) in 62 | if #available(iOS 11.0, *) { 63 | make.edges.equalTo(self.view.safeAreaLayoutGuide.snp.edges) 64 | }else{ 65 | make.edges.equalToSuperview() 66 | } 67 | } 68 | 69 | tableView.tableHeaderView = self.headerView 70 | self.headerView.snp.makeConstraints({ (make) in 71 | make.width.equalToSuperview() 72 | make.top.left.right.equalToSuperview() 73 | }) 74 | self.headerView.layoutIfNeeded() 75 | 76 | view.addSubview(loadingView) 77 | loadingView.snp.makeConstraints { (make) in 78 | make.edges.equalToSuperview() 79 | } 80 | 81 | let html = "

\"迪丽热巴banner没有LOGO.jpg\"/

在2018年农历新年来临之际

火星圈&Dear迪丽热巴后援会相约深圳进行春节探访

活动现场捐赠了制氧机、助行器、北京老布鞋、手绢套装等急需且贴心的物资和礼物;

和老人们在一起聊天、活动度过了愉快的时光

阿达飞奔来送上图片集锦~~

\"6.jpg\"/

\"1.jpg\"/

\"2.jpg\"/

\"3.jpg\"/

\"4.jpg\"/

\"5.jpg\"/




\"可爱.png\"/

" 82 | 83 | headerView.html = html 84 | } 85 | 86 | deinit { 87 | print("RichTextDemo3VC dealloc") 88 | } 89 | } 90 | 91 | extension RichTextDemo3VC: UITableViewDelegate,UITableViewDataSource{ 92 | func numberOfSections(in tableView: UITableView) -> Int { 93 | return 1 94 | } 95 | 96 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 97 | return 20 98 | } 99 | 100 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 101 | var cell = tableView.dequeueReusableCell(withIdentifier: "cell") 102 | if cell == nil { 103 | cell = UITableViewCell(style: .default, reuseIdentifier: "cell") 104 | cell?.selectionStyle = .none 105 | } 106 | cell?.textLabel?.text = "xxx" 107 | return cell! 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /RichTextDemo/Swift-Bridge-Objective-C.h: -------------------------------------------------------------------------------- 1 | // 2 | // Swift-Bridge-Objective-C.h 3 | // RichTextDemo 4 | // 5 | // Created by Tiny on 2018/12/28. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | #ifndef Swift_Bridge_Objective_C_h 10 | #define Swift_Bridge_Objective_C_h 11 | 12 | #import "GKPhotoBrowser.h" 13 | 14 | 15 | #endif /* Swift_Bridge_Objective_C_h */ 16 | -------------------------------------------------------------------------------- /RichTextDemo/UIImage+FastKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+FastKit.swift 3 | // hxquan-swift 4 | // 5 | // Created by Tiny on 2018/11/7. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension UIImage{ 12 | 13 | func savedPhotosAlbum(completeBlock: ((Bool)->Void)?){ 14 | let key:UnsafeRawPointer! = UnsafeRawPointer.init(bitPattern: "completeBlock".hashValue) 15 | objc_setAssociatedObject(self, key, completeBlock, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 16 | 17 | UIImageWriteToSavedPhotosAlbum(self, self, #selector(saveImage(image:didFinishSavingWithError:contextInfo:)), nil) 18 | } 19 | 20 | @objc func saveImage(image: UIImage, didFinishSavingWithError error: NSError?, contextInfo: AnyObject){ 21 | 22 | let key:UnsafeRawPointer! = UnsafeRawPointer.init(bitPattern: "completeBlock".hashValue) 23 | if let completeBlock = objc_getAssociatedObject(self, key) as? ((Bool)->Void) { 24 | if error == nil { 25 | //保存成功 26 | completeBlock(true) 27 | }else{ 28 | //保存失败 29 | completeBlock(false) 30 | } 31 | } 32 | } 33 | 34 | /// 将颜色转变成制定大小的图片并返回 35 | static func imageWithColor(_ color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) -> UIImage? { 36 | if size.width < 0 || size.height < 0 { 37 | return nil 38 | } 39 | let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height) 40 | UIGraphicsBeginImageContextWithOptions(rect.size, false, 0) 41 | if let context = UIGraphicsGetCurrentContext(){ 42 | context.setFillColor(color.cgColor); 43 | context.fill(rect); 44 | if let image = UIGraphicsGetImageFromCurrentImageContext(){ 45 | UIGraphicsEndImageContext(); 46 | return image 47 | } 48 | } 49 | return nil 50 | } 51 | 52 | 53 | /// 图片等比例缩放 54 | func imageByResizeToSize(size: CGSize) -> UIImage?{ 55 | if size.width < 0 || size.height < 0 { 56 | return nil 57 | } 58 | UIGraphicsBeginImageContextWithOptions(size, false, 0) 59 | draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height)) 60 | if let image = UIGraphicsGetImageFromCurrentImageContext(){ 61 | UIGraphicsEndImageContext(); 62 | return image 63 | } 64 | return nil 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /RichTextDemo/UIView+FastKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+FastKit.swift 3 | // t1 4 | // 5 | // Created by Tiny on 2018/10/23. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | //MARK:- UIView Tap事件分类 12 | extension UIView{ 13 | 14 | func fk_addGesture(FKGestureBlock:((UIView)->Void)?){ 15 | let key:UnsafeRawPointer! = UnsafeRawPointer.init(bitPattern: "fk_addGesture".hashValue) 16 | objc_setAssociatedObject(self, key, FKGestureBlock, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 17 | isUserInteractionEnabled = true 18 | let tapGesture = UITapGestureRecognizer(target: self, action: #selector(viewTapAction(_:))) 19 | self.addGestureRecognizer(tapGesture) 20 | } 21 | 22 | @objc private func viewTapAction(_ tap: UIGestureRecognizer){ 23 | let key:UnsafeRawPointer! = UnsafeRawPointer.init(bitPattern: "fk_addGesture".hashValue) 24 | if let tapBlock = objc_getAssociatedObject(self, key) as? ((UIView)->Void) { 25 | tapBlock(tap.view!) 26 | } 27 | } 28 | } 29 | 30 | //MARK:- UIView 常用frame方法分类 31 | extension UIView{ 32 | 33 | var x:CGFloat{ 34 | get{ 35 | return self.frame.origin.x 36 | } 37 | set{ 38 | var frame = self.frame; 39 | frame.origin.x = newValue 40 | self.frame = frame 41 | } 42 | } 43 | 44 | var y:CGFloat{ 45 | get{ 46 | return self.frame.origin.y 47 | } 48 | set{ 49 | var frame = self.frame; 50 | frame.origin.y = newValue 51 | self.frame = frame 52 | } 53 | } 54 | 55 | var width:CGFloat{ 56 | get{ 57 | return self.frame.size.width 58 | } 59 | set{ 60 | var frame = self.frame; 61 | frame.size.width = newValue 62 | self.frame = frame 63 | } 64 | } 65 | 66 | var height:CGFloat{ 67 | get{ 68 | return self.frame.size.height 69 | } 70 | set{ 71 | var frame = self.frame; 72 | frame.size.height = newValue 73 | self.frame = frame 74 | } 75 | } 76 | 77 | func change(index:Int) -> Void { 78 | 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /RichTextDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // RichTextDemo 4 | // 5 | // Created by Tiny on 2018/12/28. 6 | // Copyright © 2018年 hxq. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SnapKit 11 | 12 | 13 | class ViewController: UIViewController { 14 | 15 | var richTextView: RichTextView! 16 | 17 | var html: String! 18 | 19 | var webHeight: CGFloat = 0 20 | 21 | lazy var tableView: UITableView = { 22 | let tableView = UITableView(frame: .zero, style: .plain) 23 | tableView.showsVerticalScrollIndicator = false 24 | tableView.showsHorizontalScrollIndicator = false 25 | tableView.delegate = self 26 | tableView.dataSource = self 27 | if #available(iOS 11.0, *) { 28 | tableView.contentInsetAdjustmentBehavior = .never 29 | } 30 | tableView.estimatedSectionHeaderHeight = 0 31 | tableView.estimatedSectionFooterHeight = 0 32 | 33 | tableView.tableFooterView = UIView() 34 | 35 | tableView.rowHeight = UITableView.automaticDimension; 36 | tableView.estimatedRowHeight = 44; 37 | return tableView 38 | }() 39 | 40 | override func viewDidLoad() { 41 | super.viewDidLoad() 42 | // Do any additional setup after loading the view, typically from a nib. 43 | 44 | self.title = "RichText 富文本使用demo" 45 | view.addSubview(tableView) 46 | //设置tableView约束 安全区域 47 | tableView.snp.makeConstraints { (make) in 48 | if #available(iOS 11.0, *) { 49 | make.edges.equalTo(self.view.safeAreaLayoutGuide.snp.edges) 50 | }else{ 51 | make.edges.equalToSuperview() 52 | } 53 | } 54 | } 55 | } 56 | 57 | extension ViewController: UITableViewDelegate,UITableViewDataSource{ 58 | func numberOfSections(in tableView: UITableView) -> Int { 59 | return 1 60 | } 61 | 62 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 63 | return 3 64 | } 65 | 66 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 67 | var cell = tableView.dequeueReusableCell(withIdentifier: "cell") 68 | if cell == nil { 69 | cell = UITableViewCell(style: .default, reuseIdentifier: "cell") 70 | cell?.selectionStyle = .none 71 | cell?.textLabel?.numberOfLines = 0 72 | cell?.textLabel?.font = UIFont.systemFont(ofSize: 14) 73 | } 74 | let list = ["Demo1 \n全覆盖 富文本占满整个屏幕", 75 | "Demo2 \n富文本作为cell的一部分", 76 | "Demo3 \nwebView作为tableView的header并且header中还有其他的控件和业务" 77 | ] 78 | //将list转换成controller 79 | cell?.textLabel?.text = "\(list[indexPath.row])" 80 | return cell! 81 | } 82 | 83 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 84 | let vcList = ["RichTextDemo1VC","RichTextDemo2VC","RichTextDemo3VC"] 85 | let vc = stringToController(className: vcList[indexPath.row]) 86 | self.navigationController?.pushViewController(vc, animated: true) 87 | } 88 | 89 | /// 根据字符串转换成类名 90 | private func stringToController(className: String) -> UIViewController{ 91 | var name = Bundle.main.object(forInfoDictionaryKey: "CFBundleExecutable") as? String//这是获取项目的名称, 92 | /** 93 | * 如果你的工程名字中带有“-” 符号 需要加上 replacingOccurrences(of: "-", with: "_") 这句代码把“-” 替换掉 不然还会报错 要不然系统会自动替换掉 这样就不是你原来的包名了 如果不包含“-” 这句代码 可以不加 94 | */ 95 | name = name?.replacingOccurrences(of: "-", with: "_") 96 | let className = name! + "." + className 97 | guard let controller = NSClassFromString(className) as? UIViewController.Type else{ 98 | fatalError("类名不存在") 99 | } 100 | return controller.init() 101 | } 102 | 103 | } 104 | 105 | --------------------------------------------------------------------------------