├── Example ├── Assets │ ├── .gitkeep │ ├── 1.png │ ├── 2.png │ └── 3.png ├── Pods │ ├── Target Support Files │ │ ├── SDWebImage │ │ │ ├── SDWebImage.modulemap │ │ │ ├── SDWebImage-dummy.m │ │ │ ├── SDWebImage-prefix.pch │ │ │ ├── SDWebImage.xcconfig │ │ │ ├── Info.plist │ │ │ └── SDWebImage-umbrella.h │ │ ├── OTTOPhotoBrowser │ │ │ ├── OTTOPhotoBrowser.modulemap │ │ │ ├── OTTOPhotoBrowser-dummy.m │ │ │ ├── OTTOPhotoBrowser-prefix.pch │ │ │ ├── OTTOPhotoBrowser-umbrella.h │ │ │ ├── OTTOPhotoBrowser.xcconfig │ │ │ └── Info.plist │ │ ├── Pods-OTTOPhotoBrowser_Tests │ │ │ ├── Pods-OTTOPhotoBrowser_Tests-acknowledgements.markdown │ │ │ ├── Pods-OTTOPhotoBrowser_Tests.modulemap │ │ │ ├── Pods-OTTOPhotoBrowser_Tests-dummy.m │ │ │ ├── Pods-OTTOPhotoBrowser_Tests-umbrella.h │ │ │ ├── Pods-OTTOPhotoBrowser_Tests.debug.xcconfig │ │ │ ├── Pods-OTTOPhotoBrowser_Tests.release.xcconfig │ │ │ ├── Info.plist │ │ │ ├── Pods-OTTOPhotoBrowser_Tests-acknowledgements.plist │ │ │ ├── Pods-OTTOPhotoBrowser_Tests-resources.sh │ │ │ └── Pods-OTTOPhotoBrowser_Tests-frameworks.sh │ │ └── Pods-OTTOPhotoBrowser_Example │ │ │ ├── Pods-OTTOPhotoBrowser_Example.modulemap │ │ │ ├── Pods-OTTOPhotoBrowser_Example-dummy.m │ │ │ ├── Pods-OTTOPhotoBrowser_Example-umbrella.h │ │ │ ├── Pods-OTTOPhotoBrowser_Example.debug.xcconfig │ │ │ ├── Pods-OTTOPhotoBrowser_Example.release.xcconfig │ │ │ ├── Info.plist │ │ │ ├── Pods-OTTOPhotoBrowser_Example-acknowledgements.markdown │ │ │ ├── Pods-OTTOPhotoBrowser_Example-acknowledgements.plist │ │ │ ├── Pods-OTTOPhotoBrowser_Example-resources.sh │ │ │ └── Pods-OTTOPhotoBrowser_Example-frameworks.sh │ ├── SDWebImage │ │ ├── SDWebImage │ │ │ ├── SDWebImageOperation.h │ │ │ ├── NSImage+WebCache.h │ │ │ ├── UIImage+ForceDecode.h │ │ │ ├── UIImage+GIF.m │ │ │ ├── UIImage+GIF.h │ │ │ ├── SDWebImageFrame.m │ │ │ ├── SDAnimatedImageRep.h │ │ │ ├── SDImageCacheConfig.m │ │ │ ├── UIImage+ForceDecode.m │ │ │ ├── SDWebImageCoder.m │ │ │ ├── SDWebImageGIFCoder.h │ │ │ ├── NSImage+WebCache.m │ │ │ ├── SDWebImageFrame.h │ │ │ ├── SDWebImageImageIOCoder.h │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── UIView+WebCacheOperation.h │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── UIImageView+HighlightedWebCache.m │ │ │ ├── SDAnimatedImageRep.m │ │ │ ├── SDWebImageCodersManager.h │ │ │ ├── SDWebImageCompat.m │ │ │ ├── SDWebImageCoderHelper.h │ │ │ ├── UIView+WebCacheOperation.m │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDImageCacheConfig.h │ │ │ ├── UIImage+MultiFormat.m │ │ │ ├── UIImageView+HighlightedWebCache.h │ │ │ ├── NSData+ImageContentType.m │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── SDWebImageCoder.h │ │ │ ├── SDWebImageTransition.h │ │ │ ├── SDWebImageCodersManager.m │ │ │ ├── SDWebImageTransition.m │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImagePrefetcher.m │ │ │ ├── NSButton+WebCache.m │ │ │ ├── UIImageView+WebCache.m │ │ │ ├── SDWebImageGIFCoder.m │ │ │ ├── UIView+WebCache.h │ │ │ └── UIButton+WebCache.m │ │ └── LICENSE │ ├── Manifest.lock │ └── Local Podspecs │ │ └── OTTOPhotoBrowser.podspec.json ├── OTTOPhotoBrowser.xcworkspace │ ├── xcuserdata │ │ └── lukas.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── UserInterfaceState.xcuserstate │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── OTTOPhotoBrowser.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcuserdata │ │ └── lukas.xcuserdatad │ │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── OTTOPhotoBrowser-Example.xcscheme ├── Podfile ├── Podfile.lock ├── Tests │ ├── Info.plist │ └── Tests.swift └── OTTOPhotoBrowser │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.swift │ ├── AppDelegate.swift │ └── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── OTTOPhotoBrowser └── Classes │ ├── .gitkeep │ ├── OTTOPhoto.swift │ ├── OTTOPhotoBrowserDelegate.swift │ └── OTTOZoomingScrollView.swift ├── _Pods.xcodeproj ├── README.md ├── .gitignore ├── LICENSE └── OTTOPhotoBrowser.podspec /Example/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OTTOPhotoBrowser/Classes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /Example/Assets/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/otto-de-legacy/OTTOPhotoBrowser/master/Example/Assets/1.png -------------------------------------------------------------------------------- /Example/Assets/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/otto-de-legacy/OTTOPhotoBrowser/master/Example/Assets/2.png -------------------------------------------------------------------------------- /Example/Assets/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/otto-de-legacy/OTTOPhotoBrowser/master/Example/Assets/3.png -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcworkspace/xcuserdata/lukas.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OTTOPhotoBrowser/OTTOPhotoBrowser.modulemap: -------------------------------------------------------------------------------- 1 | framework module OTTOPhotoBrowser { 2 | umbrella header "OTTOPhotoBrowser-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OTTOPhotoBrowser/OTTOPhotoBrowser-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_OTTOPhotoBrowser : NSObject 3 | @end 4 | @implementation PodsDummy_OTTOPhotoBrowser 5 | @end 6 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcworkspace/xcuserdata/lukas.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/otto-de-legacy/OTTOPhotoBrowser/master/Example/OTTOPhotoBrowser.xcworkspace/xcuserdata/lukas.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_OTTOPhotoBrowser_Tests { 2 | umbrella header "Pods-OTTOPhotoBrowser_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_OTTOPhotoBrowser_Example { 2 | umbrella header "Pods-OTTOPhotoBrowser_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_OTTOPhotoBrowser_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_OTTOPhotoBrowser_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | inhibit_all_warnings! 3 | 4 | target 'OTTOPhotoBrowser_Example' do 5 | pod 'OTTOPhotoBrowser', :path => '../' 6 | pod 'SDWebImage' 7 | 8 | target 'OTTOPhotoBrowser_Tests' do 9 | inherit! :search_paths 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_OTTOPhotoBrowser_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_OTTOPhotoBrowser_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OTTOPhotoBrowser/OTTOPhotoBrowser-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 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OTTOPhotoBrowser 2 | 3 | Image zoom view based on [ideaismobile/IDMPhotoBrowser](https://github.com/ideaismobile/IDMPhotoBrowser). This is a view based re-implementation in Swift, however with a limited subset of the features of IDMPhotoBrowser. 4 | 5 | Features: 6 | 7 | * Subclass of UIView (allows for more layout flexibility) 8 | * Endless scrolling 9 | * Delegate methods 10 | 11 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OTTOPhotoBrowser/OTTOPhotoBrowser-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 OTTOPhotoBrowserVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char OTTOPhotoBrowserVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests-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_OTTOPhotoBrowser_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_OTTOPhotoBrowser_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build generated 2 | build/ 3 | DerivedData/ 4 | 5 | # Various settings 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | 16 | # Other 17 | *.moved-aside 18 | *.xcuserstate 19 | 20 | # Swift specific 21 | *.hmap 22 | *.ipa 23 | *.dSYM.zip 24 | *.dSYM 25 | 26 | # Playgrounds 27 | timeline.xctimeline 28 | playground.xcworkspace 29 | 30 | # Swift Package Manager 31 | .build/ 32 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example-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_OTTOPhotoBrowser_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_OTTOPhotoBrowser_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/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 = -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 | -------------------------------------------------------------------------------- /OTTOPhotoBrowser/Classes/OTTOPhoto.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OTTOPhoto.swift 3 | // OTTOPhotoBrowser 4 | // 5 | // Created by Lukas Zielinski on 22/12/2016. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class OTTOPhoto: Equatable { 12 | let url: URL 13 | var image: UIImage? 14 | 15 | public init(withUrl url: URL) { 16 | self.url = url 17 | } 18 | } 19 | 20 | public func ==(lhs: OTTOPhoto, rhs: OTTOPhoto) -> Bool { 21 | return lhs.url == rhs.url 22 | } 23 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcodeproj/xcuserdata/lukas.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SuppressBuildableAutocreation 6 | 7 | 607FACCF1AFB9204008FA782 8 | 9 | primary 10 | 11 | 12 | 607FACE41AFB9204008FA782 13 | 14 | primary 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OTTOPhotoBrowser (1.6): 3 | - SDWebImage 4 | - SDWebImage (4.4.2): 5 | - SDWebImage/Core (= 4.4.2) 6 | - SDWebImage/Core (4.4.2) 7 | 8 | DEPENDENCIES: 9 | - OTTOPhotoBrowser (from `../`) 10 | - SDWebImage 11 | 12 | SPEC REPOS: 13 | https://github.com/cocoapods/specs.git: 14 | - SDWebImage 15 | 16 | EXTERNAL SOURCES: 17 | OTTOPhotoBrowser: 18 | :path: "../" 19 | 20 | SPEC CHECKSUMS: 21 | OTTOPhotoBrowser: 58d8f1e15d03ee6bc6ce050f1b16322eed0acafd 22 | SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681 23 | 24 | PODFILE CHECKSUM: cfec6ae5e75473859b11fb25042537a3a5189871 25 | 26 | COCOAPODS: 1.5.3 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OTTOPhotoBrowser/OTTOPhotoBrowser.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" "-suppress-warnings" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OTTOPhotoBrowser (1.6): 3 | - SDWebImage 4 | - SDWebImage (4.4.2): 5 | - SDWebImage/Core (= 4.4.2) 6 | - SDWebImage/Core (4.4.2) 7 | 8 | DEPENDENCIES: 9 | - OTTOPhotoBrowser (from `../`) 10 | - SDWebImage 11 | 12 | SPEC REPOS: 13 | https://github.com/cocoapods/specs.git: 14 | - SDWebImage 15 | 16 | EXTERNAL SOURCES: 17 | OTTOPhotoBrowser: 18 | :path: "../" 19 | 20 | SPEC CHECKSUMS: 21 | OTTOPhotoBrowser: 58d8f1e15d03ee6bc6ce050f1b16322eed0acafd 22 | SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681 23 | 24 | PODFILE CHECKSUM: cfec6ae5e75473859b11fb25042537a3a5189871 25 | 26 | COCOAPODS: 1.5.3 27 | -------------------------------------------------------------------------------- /OTTOPhotoBrowser/Classes/OTTOPhotoBrowserDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OTTOPhotoBrowserDelegate.swift 3 | // OTTOPhotoBrowser 4 | // 5 | // Created by Lukas Zielinski on 23/12/2016. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public enum OTTOPhotoBrowserEvent { 12 | case pinchout // The user pinch-zoomed out beyond a certain treshold. Can be used as a close event. 13 | case tap 14 | case pinchZoom 15 | case doubleTapZoom 16 | case didSwipeToImage 17 | } 18 | 19 | public protocol OTTOPhotoBrowserDelegate: class { 20 | func photoBrowser(_ photoBrowser: OTTOPhotoBrowserView, firedEvent: OTTOPhotoBrowserEvent) 21 | } 22 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser/OTTOPhotoBrowser.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/OTTOPhotoBrowser.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OTTOPhotoBrowser", 3 | "version": "1.6", 4 | "summary": "A short description of OTTOPhotoBrowser.", 5 | "description": "TODO: Add long description of the pod here.", 6 | "homepage": "https://github.com//OTTOPhotoBrowser", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "Lukas Zielinski": "lukas.zielinski@otto.de" 13 | }, 14 | "source": { 15 | "git": "https://github.com//OTTOPhotoBrowser.git", 16 | "tag": "1.6" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "OTTOPhotoBrowser/Classes/**/*", 22 | "dependencies": { 23 | "SDWebImage": [ 24 | 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser/OTTOPhotoBrowser.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Tests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import XCTest 3 | import OTTOPhotoBrowser 4 | 5 | class Tests: XCTestCase { 6 | 7 | override func setUp() { 8 | super.setUp() 9 | // Put setup code here. This method is called before the invocation of each test method in the class. 10 | } 11 | 12 | override func tearDown() { 13 | // Put teardown code here. This method is called after the invocation of each test method in the class. 14 | super.tearDown() 15 | } 16 | 17 | func testExample() { 18 | // This is an example of a functional test case. 19 | XCTAssert(true, "Pass") 20 | } 21 | 22 | func testPerformanceExample() { 23 | // This is an example of a performance test case. 24 | self.measure() { 25 | // Put the code you want to measure the time of here. 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser/OTTOPhotoBrowser.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "OTTOPhotoBrowser" -framework "SDWebImage" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SDWebImage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.4.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OTTOPhotoBrowser/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.6.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/OTTOPhotoBrowser/OTTOPhotoBrowser.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "OTTOPhotoBrowser" -framework "SDWebImage" 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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/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 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser/Images.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 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | Copyright (c) 2017 Otto (GmbH & Co KG) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in the 6 | Software without restriction, including without limitation the rights to use, copy, 7 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 8 | and to permit persons to whom the Software is furnished to do so, subject to the 9 | following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies 12 | or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 17 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19 | OR OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | }; 22 | 23 | @interface NSData (ImageContentType) 24 | 25 | /** 26 | * Return image format 27 | * 28 | * @param data the input image data 29 | * 30 | * @return the image format as `SDImageFormat` (enum) 31 | */ 32 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 33 | 34 | /** 35 | * Convert SDImageFormat to UTType 36 | * 37 | * @param format Format as SDImageFormat 38 | * @return The UTType as CFStringRef 39 | */ 40 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format; 41 | 42 | /** 43 | * Convert UTTyppe to SDImageFormat 44 | * 45 | * @param uttype The UTType as CFStringRef 46 | * @return The Format as SDImageFormat 47 | */ 48 | + (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSApplicationCategoryType 6 | 7 | NSAppTransportSecurity 8 | 9 | NSAllowsArbitraryLoads 10 | 11 | 12 | CFBundleDevelopmentRegion 13 | en 14 | CFBundleExecutable 15 | $(EXECUTABLE_NAME) 16 | CFBundleIdentifier 17 | $(PRODUCT_BUNDLE_IDENTIFIER) 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | $(PRODUCT_NAME) 22 | CFBundlePackageType 23 | APPL 24 | CFBundleShortVersionString 25 | 1.0 26 | CFBundleSignature 27 | ???? 28 | CFBundleVersion 29 | 1 30 | LSRequiresIPhoneOS 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UIRequiredDeviceCapabilities 37 | 38 | armv7 39 | 40 | UISupportedInterfaceOrientations 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /OTTOPhotoBrowser.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint OTTOPhotoBrowser.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'OTTOPhotoBrowser' 11 | s.version = '1.6' 12 | s.summary = 'A short description of OTTOPhotoBrowser.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | TODO: Add long description of the pod here. 22 | DESC 23 | 24 | s.homepage = 'https://github.com//OTTOPhotoBrowser' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'Lukas Zielinski' => 'lukas.zielinski@otto.de' } 28 | s.source = { :git => 'https://github.com//OTTOPhotoBrowser.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '8.0' 32 | 33 | s.source_files = 'OTTOPhotoBrowser/Classes/**/*' 34 | 35 | # s.resource_bundles = { 36 | # 'OTTOPhotoBrowser' => ['OTTOPhotoBrowser/Assets/*.png'] 37 | # } 38 | 39 | # s.public_header_files = 'Pod/Classes/**/*.h' 40 | # s.frameworks = 'UIKit', 'MapKit' 41 | # s.dependency 'AFNetworking', '~> 2.3' 42 | s.dependency 'SDWebImage' 43 | end 44 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // OTTOPhotoBrowser 4 | // 5 | // Created by Lukas Zielinski on 12/22/2016. 6 | // Copyright (c) 2016 Lukas Zielinski. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import OTTOPhotoBrowser 11 | 12 | class ViewController: UIViewController, OTTOPhotoBrowserDelegate { 13 | 14 | @IBOutlet var photoBrowser: OTTOPhotoBrowserView! 15 | @IBOutlet var counterLabel: UILabel! 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | let photos = [ 21 | "https://github.com/otto-de/OTTOPhotoBrowser/raw/master/Example/Assets/1.png", 22 | "https://github.com/otto-de/OTTOPhotoBrowser/raw/master/Example/Assets/2.png", 23 | "https://github.com/otto-de/OTTOPhotoBrowser/raw/master/Example/Assets/3.png" 24 | ].map { OTTOPhoto(withUrl: URL(string: $0)!) } 25 | 26 | photoBrowser.delegate = self 27 | photoBrowser.photos = photos 28 | photoBrowser.padding = 12 29 | photoBrowser.margin = 3 30 | 31 | updateCounterLabel() 32 | } 33 | 34 | // MARK: OTTOPhotoBrowserDelegate 35 | 36 | func photoBrowser(_ photoBrowser: OTTOPhotoBrowserView, firedEvent event: OTTOPhotoBrowserEvent) { 37 | switch event { 38 | case .didSwipeToImage: updateCounterLabel() 39 | case .doubleTapZoom: print("EVENT: double tap zoom") 40 | case .pinchout: print("EVENT: pinchout") 41 | case .pinchZoom: print("EVENT: pinchzoom") 42 | case .tap: print("EVENT: tap -- show image index 2") 43 | photoBrowser.showImage(index: 2) 44 | } 45 | } 46 | 47 | private func updateCounterLabel() { 48 | let text = "\(photoBrowser.currentPageIndex + 1)/\(photoBrowser.photos.count)" 49 | counterLabel.text = text 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // OTTOPhotoBrowser 4 | // 5 | // Created by Lukas Zielinski on 12/22/2016. 6 | // Copyright (c) 2016 Lukas Zielinski. 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 61 | scaledImage.sd_imageFormat = image.sd_imageFormat; 62 | image = scaledImage; 63 | } 64 | return image; 65 | } 66 | #endif 67 | } 68 | 69 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 70 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## OTTOPhotoBrowser 5 | 6 | MIT License 7 | Copyright (c) 2017 Otto (GmbH & Co KG) 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of 10 | this software and associated documentation files (the "Software"), to deal in the 11 | Software without restriction, including without limitation the rights to use, copy, 12 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 13 | and to permit persons to whom the Software is furnished to do so, subject to the 14 | following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all copies 17 | or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 20 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 21 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 24 | OR OTHER DEALINGS IN THE SOFTWARE. 25 | 26 | 27 | ## SDWebImage 28 | 29 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is furnished 36 | to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in all 39 | copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 47 | THE SOFTWARE. 48 | 49 | 50 | Generated by CocoaPods - https://cocoapods.org 51 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | Copyright (c) 2017 Otto (GmbH & Co KG) 19 | 20 | Permission is hereby granted, free of charge, to any person obtaining a copy of 21 | this software and associated documentation files (the "Software"), to deal in the 22 | Software without restriction, including without limitation the rights to use, copy, 23 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 24 | and to permit persons to whom the Software is furnished to do so, subject to the 25 | following conditions: 26 | 27 | The above copyright notice and this permission notice shall be included in all copies 28 | or substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 31 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 32 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 33 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 34 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 35 | OR OTHER DEALINGS IN THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | OTTOPhotoBrowser 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is furnished 53 | to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in all 56 | copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | 66 | 67 | License 68 | MIT 69 | Title 70 | SDWebImage 71 | Type 72 | PSGroupSpecifier 73 | 74 | 75 | FooterText 76 | Generated by CocoaPods - https://cocoapods.org 77 | Title 78 | 79 | Type 80 | PSGroupSpecifier 81 | 82 | 83 | StringsTable 84 | Acknowledgements 85 | Title 86 | Acknowledgements 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 is defined in AVFoundation via iOS 11, we use this without import AVFoundation 20 | #define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic") 21 | 22 | @implementation NSData (ImageContentType) 23 | 24 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { 25 | if (!data) { 26 | return SDImageFormatUndefined; 27 | } 28 | 29 | // File signatures table: http://www.garykessler.net/library/file_sigs.html 30 | uint8_t c; 31 | [data getBytes:&c length:1]; 32 | switch (c) { 33 | case 0xFF: 34 | return SDImageFormatJPEG; 35 | case 0x89: 36 | return SDImageFormatPNG; 37 | case 0x47: 38 | return SDImageFormatGIF; 39 | case 0x49: 40 | case 0x4D: 41 | return SDImageFormatTIFF; 42 | case 0x52: { 43 | if (data.length >= 12) { 44 | //RIFF....WEBP 45 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 46 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 47 | return SDImageFormatWebP; 48 | } 49 | } 50 | break; 51 | } 52 | case 0x00: { 53 | if (data.length >= 12) { 54 | //....ftypheic ....ftypheix ....ftyphevc ....ftyphevx 55 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(4, 8)] encoding:NSASCIIStringEncoding]; 56 | if ([testString isEqualToString:@"ftypheic"] 57 | || [testString isEqualToString:@"ftypheix"] 58 | || [testString isEqualToString:@"ftyphevc"] 59 | || [testString isEqualToString:@"ftyphevx"]) { 60 | return SDImageFormatHEIC; 61 | } 62 | } 63 | break; 64 | } 65 | } 66 | return SDImageFormatUndefined; 67 | } 68 | 69 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format { 70 | CFStringRef UTType; 71 | switch (format) { 72 | case SDImageFormatJPEG: 73 | UTType = kUTTypeJPEG; 74 | break; 75 | case SDImageFormatPNG: 76 | UTType = kUTTypePNG; 77 | break; 78 | case SDImageFormatGIF: 79 | UTType = kUTTypeGIF; 80 | break; 81 | case SDImageFormatTIFF: 82 | UTType = kUTTypeTIFF; 83 | break; 84 | case SDImageFormatWebP: 85 | UTType = kSDUTTypeWebP; 86 | break; 87 | case SDImageFormatHEIC: 88 | UTType = kSDUTTypeHEIC; 89 | break; 90 | default: 91 | // default is kUTTypePNG 92 | UTType = kUTTypePNG; 93 | break; 94 | } 95 | return UTType; 96 | } 97 | 98 | + (SDImageFormat)sd_imageFormatFromUTType:(CFStringRef)uttype { 99 | if (!uttype) { 100 | return SDImageFormatUndefined; 101 | } 102 | SDImageFormat imageFormat; 103 | if (CFStringCompare(uttype, kUTTypeJPEG, 0) == kCFCompareEqualTo) { 104 | imageFormat = SDImageFormatJPEG; 105 | } else if (CFStringCompare(uttype, kUTTypePNG, 0) == kCFCompareEqualTo) { 106 | imageFormat = SDImageFormatPNG; 107 | } else if (CFStringCompare(uttype, kUTTypeGIF, 0) == kCFCompareEqualTo) { 108 | imageFormat = SDImageFormatGIF; 109 | } else if (CFStringCompare(uttype, kUTTypeTIFF, 0) == kCFCompareEqualTo) { 110 | imageFormat = SDImageFormatTIFF; 111 | } else if (CFStringCompare(uttype, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { 112 | imageFormat = SDImageFormatWebP; 113 | } else if (CFStringCompare(uttype, kSDUTTypeHEIC, 0) == kCFCompareEqualTo) { 114 | imageFormat = SDImageFormatHEIC; 115 | } else { 116 | imageFormat = SDImageFormatUndefined; 117 | } 118 | return imageFormat; 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/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 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser.xcodeproj/xcshareddata/xcschemes/OTTOPhotoBrowser-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageCodersManager.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 "SDWebImageCodersManager.h" 10 | #import "SDWebImageImageIOCoder.h" 11 | #import "SDWebImageGIFCoder.h" 12 | #ifdef SD_WEBP 13 | #import "SDWebImageWebPCoder.h" 14 | #endif 15 | #import "UIImage+MultiFormat.h" 16 | 17 | #define LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); 18 | #define UNLOCK(lock) dispatch_semaphore_signal(lock); 19 | 20 | @interface SDWebImageCodersManager () 21 | 22 | @property (nonatomic, strong, nonnull) dispatch_semaphore_t codersLock; 23 | 24 | @end 25 | 26 | @implementation SDWebImageCodersManager 27 | 28 | + (nonnull instancetype)sharedInstance { 29 | static dispatch_once_t once; 30 | static id instance; 31 | dispatch_once(&once, ^{ 32 | instance = [self new]; 33 | }); 34 | return instance; 35 | } 36 | 37 | - (instancetype)init { 38 | if (self = [super init]) { 39 | // initialize with default coders 40 | NSMutableArray> *mutableCoders = [@[[SDWebImageImageIOCoder sharedCoder]] mutableCopy]; 41 | #ifdef SD_WEBP 42 | [mutableCoders addObject:[SDWebImageWebPCoder sharedCoder]]; 43 | #endif 44 | _coders = [mutableCoders copy]; 45 | _codersLock = dispatch_semaphore_create(1); 46 | } 47 | return self; 48 | } 49 | 50 | #pragma mark - Coder IO operations 51 | 52 | - (void)addCoder:(nonnull id)coder { 53 | if (![coder conformsToProtocol:@protocol(SDWebImageCoder)]) { 54 | return; 55 | } 56 | LOCK(self.codersLock); 57 | NSMutableArray> *mutableCoders = [self.coders mutableCopy]; 58 | if (!mutableCoders) { 59 | mutableCoders = [NSMutableArray array]; 60 | } 61 | [mutableCoders addObject:coder]; 62 | self.coders = [mutableCoders copy]; 63 | UNLOCK(self.codersLock); 64 | } 65 | 66 | - (void)removeCoder:(nonnull id)coder { 67 | if (![coder conformsToProtocol:@protocol(SDWebImageCoder)]) { 68 | return; 69 | } 70 | LOCK(self.codersLock); 71 | NSMutableArray> *mutableCoders = [self.coders mutableCopy]; 72 | [mutableCoders removeObject:coder]; 73 | self.coders = [mutableCoders copy]; 74 | UNLOCK(self.codersLock); 75 | } 76 | 77 | #pragma mark - SDWebImageCoder 78 | - (BOOL)canDecodeFromData:(NSData *)data { 79 | LOCK(self.codersLock); 80 | NSArray> *coders = self.coders; 81 | UNLOCK(self.codersLock); 82 | for (id coder in coders.reverseObjectEnumerator) { 83 | if ([coder canDecodeFromData:data]) { 84 | return YES; 85 | } 86 | } 87 | return NO; 88 | } 89 | 90 | - (BOOL)canEncodeToFormat:(SDImageFormat)format { 91 | LOCK(self.codersLock); 92 | NSArray> *coders = self.coders; 93 | UNLOCK(self.codersLock); 94 | for (id coder in coders.reverseObjectEnumerator) { 95 | if ([coder canEncodeToFormat:format]) { 96 | return YES; 97 | } 98 | } 99 | return NO; 100 | } 101 | 102 | - (UIImage *)decodedImageWithData:(NSData *)data { 103 | LOCK(self.codersLock); 104 | NSArray> *coders = self.coders; 105 | UNLOCK(self.codersLock); 106 | for (id coder in coders.reverseObjectEnumerator) { 107 | if ([coder canDecodeFromData:data]) { 108 | return [coder decodedImageWithData:data]; 109 | } 110 | } 111 | return nil; 112 | } 113 | 114 | - (UIImage *)decompressedImageWithImage:(UIImage *)image 115 | data:(NSData *__autoreleasing _Nullable *)data 116 | options:(nullable NSDictionary*)optionsDict { 117 | if (!image) { 118 | return nil; 119 | } 120 | LOCK(self.codersLock); 121 | NSArray> *coders = self.coders; 122 | UNLOCK(self.codersLock); 123 | for (id coder in coders.reverseObjectEnumerator) { 124 | if ([coder canDecodeFromData:*data]) { 125 | UIImage *decompressedImage = [coder decompressedImageWithImage:image data:data options:optionsDict]; 126 | decompressedImage.sd_imageFormat = image.sd_imageFormat; 127 | return decompressedImage; 128 | } 129 | } 130 | return nil; 131 | } 132 | 133 | - (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format { 134 | if (!image) { 135 | return nil; 136 | } 137 | LOCK(self.codersLock); 138 | NSArray> *coders = self.coders; 139 | UNLOCK(self.codersLock); 140 | for (id coder in coders.reverseObjectEnumerator) { 141 | if ([coder canEncodeToFormat:format]) { 142 | return [coder encodedDataWithImage:image format:format]; 143 | } 144 | } 145 | return nil; 146 | } 147 | 148 | @end 149 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageTransition.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 "SDWebImageTransition.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #if SD_MAC 14 | #import 15 | #endif 16 | 17 | @implementation SDWebImageTransition 18 | 19 | - (instancetype)init { 20 | self = [super init]; 21 | if (self) { 22 | self.duration = 0.5; 23 | } 24 | return self; 25 | } 26 | 27 | @end 28 | 29 | @implementation SDWebImageTransition (Conveniences) 30 | 31 | + (SDWebImageTransition *)fadeTransition { 32 | SDWebImageTransition *transition = [SDWebImageTransition new]; 33 | #if SD_UIKIT 34 | transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction; 35 | #else 36 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 37 | CATransition *trans = [CATransition animation]; 38 | trans.type = kCATransitionFade; 39 | [view.layer addAnimation:trans forKey:kCATransition]; 40 | }; 41 | #endif 42 | return transition; 43 | } 44 | 45 | + (SDWebImageTransition *)flipFromLeftTransition { 46 | SDWebImageTransition *transition = [SDWebImageTransition new]; 47 | #if SD_UIKIT 48 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction; 49 | #else 50 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 51 | CATransition *trans = [CATransition animation]; 52 | trans.type = kCATransitionPush; 53 | trans.subtype = kCATransitionFromLeft; 54 | [view.layer addAnimation:trans forKey:kCATransition]; 55 | }; 56 | #endif 57 | return transition; 58 | } 59 | 60 | + (SDWebImageTransition *)flipFromRightTransition { 61 | SDWebImageTransition *transition = [SDWebImageTransition new]; 62 | #if SD_UIKIT 63 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction; 64 | #else 65 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 66 | CATransition *trans = [CATransition animation]; 67 | trans.type = kCATransitionPush; 68 | trans.subtype = kCATransitionFromRight; 69 | [view.layer addAnimation:trans forKey:kCATransition]; 70 | }; 71 | #endif 72 | return transition; 73 | } 74 | 75 | + (SDWebImageTransition *)flipFromTopTransition { 76 | SDWebImageTransition *transition = [SDWebImageTransition new]; 77 | #if SD_UIKIT 78 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction; 79 | #else 80 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 81 | CATransition *trans = [CATransition animation]; 82 | trans.type = kCATransitionPush; 83 | trans.subtype = kCATransitionFromTop; 84 | [view.layer addAnimation:trans forKey:kCATransition]; 85 | }; 86 | #endif 87 | return transition; 88 | } 89 | 90 | + (SDWebImageTransition *)flipFromBottomTransition { 91 | SDWebImageTransition *transition = [SDWebImageTransition new]; 92 | #if SD_UIKIT 93 | transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction; 94 | #else 95 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 96 | CATransition *trans = [CATransition animation]; 97 | trans.type = kCATransitionPush; 98 | trans.subtype = kCATransitionFromBottom; 99 | [view.layer addAnimation:trans forKey:kCATransition]; 100 | }; 101 | #endif 102 | return transition; 103 | } 104 | 105 | + (SDWebImageTransition *)curlUpTransition { 106 | SDWebImageTransition *transition = [SDWebImageTransition new]; 107 | #if SD_UIKIT 108 | transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction; 109 | #else 110 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 111 | CATransition *trans = [CATransition animation]; 112 | trans.type = kCATransitionReveal; 113 | trans.subtype = kCATransitionFromTop; 114 | [view.layer addAnimation:trans forKey:kCATransition]; 115 | }; 116 | #endif 117 | return transition; 118 | } 119 | 120 | + (SDWebImageTransition *)curlDownTransition { 121 | SDWebImageTransition *transition = [SDWebImageTransition new]; 122 | #if SD_UIKIT 123 | transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction; 124 | #else 125 | transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 126 | CATransition *trans = [CATransition animation]; 127 | trans.type = kCATransitionReveal; 128 | trans.subtype = kCATransitionFromBottom; 129 | [view.layer addAnimation:trans forKey:kCATransition]; 130 | }; 131 | #endif 132 | return transition; 133 | } 134 | 135 | @end 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageDownloader.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStartNotification; 14 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadReceiveResponseNotification; 15 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification; 16 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadFinishNotification; 17 | 18 | 19 | 20 | /** 21 | Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol 22 | For the description about these methods, see `SDWebImageDownloaderOperation` 23 | */ 24 | @protocol SDWebImageDownloaderOperationInterface 25 | 26 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 27 | inSession:(nullable NSURLSession *)session 28 | options:(SDWebImageDownloaderOptions)options; 29 | 30 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 31 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 32 | 33 | - (BOOL)shouldDecompressImages; 34 | - (void)setShouldDecompressImages:(BOOL)value; 35 | 36 | - (nullable NSURLCredential *)credential; 37 | - (void)setCredential:(nullable NSURLCredential *)value; 38 | 39 | - (BOOL)cancel:(nullable id)token; 40 | 41 | @end 42 | 43 | 44 | @interface SDWebImageDownloaderOperation : NSOperation 45 | 46 | /** 47 | * The request used by the operation's task. 48 | */ 49 | @property (strong, nonatomic, readonly, nullable) NSURLRequest *request; 50 | 51 | /** 52 | * The operation's task 53 | */ 54 | @property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; 55 | 56 | 57 | @property (assign, nonatomic) BOOL shouldDecompressImages; 58 | 59 | /** 60 | * Was used to determine whether the URL connection should consult the credential storage for authenticating the connection. 61 | * @deprecated Not used for a couple of versions 62 | */ 63 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility"); 64 | 65 | /** 66 | * The credential used for authentication challenges in `-URLSession:task:didReceiveChallenge:completionHandler:`. 67 | * 68 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 69 | */ 70 | @property (nonatomic, strong, nullable) NSURLCredential *credential; 71 | 72 | /** 73 | * The SDWebImageDownloaderOptions for the receiver. 74 | */ 75 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 76 | 77 | /** 78 | * The expected size of data. 79 | */ 80 | @property (assign, nonatomic) NSInteger expectedSize; 81 | 82 | /** 83 | * The response returned by the operation's task. 84 | */ 85 | @property (strong, nonatomic, nullable) NSURLResponse *response; 86 | 87 | /** 88 | * Initializes a `SDWebImageDownloaderOperation` object 89 | * 90 | * @see SDWebImageDownloaderOperation 91 | * 92 | * @param request the URL request 93 | * @param session the URL session in which this operation will run 94 | * @param options downloader options 95 | * 96 | * @return the initialized instance 97 | */ 98 | - (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request 99 | inSession:(nullable NSURLSession *)session 100 | options:(SDWebImageDownloaderOptions)options NS_DESIGNATED_INITIALIZER; 101 | 102 | /** 103 | * Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of 104 | * callbacks. 105 | * 106 | * @param progressBlock the block executed when a new chunk of data arrives. 107 | * @note the progress block is executed on a background queue 108 | * @param completedBlock the block executed when the download is done. 109 | * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue 110 | * 111 | * @return the token to use to cancel this set of handlers 112 | */ 113 | - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 114 | completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; 115 | 116 | /** 117 | * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. 118 | * 119 | * @param token the token representing a set of callbacks to cancel 120 | * 121 | * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. 122 | */ 123 | - (BOOL)cancel:(nullable id)token; 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /Example/OTTOPhotoBrowser/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 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImagePrefetcher.h" 10 | 11 | @interface SDWebImagePrefetcher () 12 | 13 | @property (strong, nonatomic, nonnull) SDWebImageManager *manager; 14 | @property (strong, atomic, nullable) NSArray *prefetchURLs; // may be accessed from different queue 15 | @property (assign, nonatomic) NSUInteger requestedCount; 16 | @property (assign, nonatomic) NSUInteger skippedCount; 17 | @property (assign, nonatomic) NSUInteger finishedCount; 18 | @property (assign, nonatomic) NSTimeInterval startedTime; 19 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; 20 | @property (copy, nonatomic, nullable) SDWebImagePrefetcherProgressBlock progressBlock; 21 | 22 | @end 23 | 24 | @implementation SDWebImagePrefetcher 25 | 26 | + (nonnull instancetype)sharedImagePrefetcher { 27 | static dispatch_once_t once; 28 | static id instance; 29 | dispatch_once(&once, ^{ 30 | instance = [self new]; 31 | }); 32 | return instance; 33 | } 34 | 35 | - (nonnull instancetype)init { 36 | return [self initWithImageManager:[SDWebImageManager new]]; 37 | } 38 | 39 | - (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { 40 | if ((self = [super init])) { 41 | _manager = manager; 42 | _options = SDWebImageLowPriority; 43 | _prefetcherQueue = dispatch_get_main_queue(); 44 | self.maxConcurrentDownloads = 3; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { 50 | self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; 51 | } 52 | 53 | - (NSUInteger)maxConcurrentDownloads { 54 | return self.manager.imageDownloader.maxConcurrentDownloads; 55 | } 56 | 57 | - (void)startPrefetchingAtIndex:(NSUInteger)index { 58 | NSURL *currentURL; 59 | @synchronized(self) { 60 | if (index >= self.prefetchURLs.count) return; 61 | currentURL = self.prefetchURLs[index]; 62 | self.requestedCount++; 63 | } 64 | [self.manager loadImageWithURL:currentURL options:self.options progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 65 | if (!finished) return; 66 | self.finishedCount++; 67 | 68 | if (self.progressBlock) { 69 | self.progressBlock(self.finishedCount,(self.prefetchURLs).count); 70 | } 71 | if (!image) { 72 | // Add last failed 73 | self.skippedCount++; 74 | } 75 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 76 | [self.delegate imagePrefetcher:self 77 | didPrefetchURL:currentURL 78 | finishedCount:self.finishedCount 79 | totalCount:self.prefetchURLs.count 80 | ]; 81 | } 82 | if (self.prefetchURLs.count > self.requestedCount) { 83 | dispatch_async(self.prefetcherQueue, ^{ 84 | // we need dispatch to avoid function recursion call. This can prevent stack overflow even for huge urls list 85 | [self startPrefetchingAtIndex:self.requestedCount]; 86 | }); 87 | } else if (self.finishedCount == self.requestedCount) { 88 | [self reportStatus]; 89 | if (self.completionBlock) { 90 | self.completionBlock(self.finishedCount, self.skippedCount); 91 | self.completionBlock = nil; 92 | } 93 | self.progressBlock = nil; 94 | } 95 | }]; 96 | } 97 | 98 | - (void)reportStatus { 99 | NSUInteger total = (self.prefetchURLs).count; 100 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 101 | [self.delegate imagePrefetcher:self 102 | didFinishWithTotalCount:(total - self.skippedCount) 103 | skippedCount:self.skippedCount 104 | ]; 105 | } 106 | } 107 | 108 | - (void)prefetchURLs:(nullable NSArray *)urls { 109 | [self prefetchURLs:urls progress:nil completed:nil]; 110 | } 111 | 112 | - (void)prefetchURLs:(nullable NSArray *)urls 113 | progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock 114 | completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { 115 | [self cancelPrefetching]; // Prevent duplicate prefetch request 116 | self.startedTime = CFAbsoluteTimeGetCurrent(); 117 | self.prefetchURLs = urls; 118 | self.completionBlock = completionBlock; 119 | self.progressBlock = progressBlock; 120 | 121 | if (urls.count == 0) { 122 | if (completionBlock) { 123 | completionBlock(0,0); 124 | } 125 | } else { 126 | // Starts prefetching from the very first image on the list with the max allowed concurrency 127 | NSUInteger listCount = self.prefetchURLs.count; 128 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 129 | [self startPrefetchingAtIndex:i]; 130 | } 131 | } 132 | } 133 | 134 | - (void)cancelPrefetching { 135 | @synchronized(self) { 136 | self.prefetchURLs = nil; 137 | self.skippedCount = 0; 138 | self.requestedCount = 0; 139 | self.finishedCount = 0; 140 | } 141 | [self.manager cancelAll]; 142 | } 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/NSButton+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 "NSButton+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | static inline NSString * imageOperationKey() { 18 | return @"NSButtonImageOperation"; 19 | } 20 | 21 | static inline NSString * alternateImageOperationKey() { 22 | return @"NSButtonAlternateImageOperation"; 23 | } 24 | 25 | @implementation NSButton (WebCache) 26 | 27 | #pragma mark - Image 28 | 29 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 30 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 31 | } 32 | 33 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 34 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 35 | } 36 | 37 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 38 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 39 | } 40 | 41 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 42 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 43 | } 44 | 45 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 46 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 47 | } 48 | 49 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 50 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 51 | } 52 | 53 | - (void)sd_setImageWithURL:(nullable NSURL *)url 54 | placeholderImage:(nullable UIImage *)placeholder 55 | options:(SDWebImageOptions)options 56 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 57 | completed:(nullable SDExternalCompletionBlock)completedBlock { 58 | self.sd_currentImageURL = url; 59 | 60 | __weak typeof(self)weakSelf = self; 61 | [self sd_internalSetImageWithURL:url 62 | placeholderImage:placeholder 63 | options:options 64 | operationKey:imageOperationKey() 65 | setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData) { 66 | weakSelf.image = image; 67 | } 68 | progress:progressBlock 69 | completed:completedBlock]; 70 | } 71 | 72 | #pragma mark - Alternate Image 73 | 74 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url { 75 | [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 76 | } 77 | 78 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 79 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 80 | } 81 | 82 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 83 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 84 | } 85 | 86 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 87 | [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 88 | } 89 | 90 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 91 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 92 | } 93 | 94 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 95 | [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 96 | } 97 | 98 | - (void)sd_setAlternateImageWithURL:(nullable NSURL *)url 99 | placeholderImage:(nullable UIImage *)placeholder 100 | options:(SDWebImageOptions)options 101 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 102 | completed:(nullable SDExternalCompletionBlock)completedBlock { 103 | self.sd_currentAlternateImageURL = url; 104 | 105 | __weak typeof(self)weakSelf = self; 106 | [self sd_internalSetImageWithURL:url 107 | placeholderImage:placeholder 108 | options:options 109 | operationKey:alternateImageOperationKey() 110 | setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData) { 111 | weakSelf.alternateImage = image; 112 | } 113 | progress:progressBlock 114 | completed:completedBlock]; 115 | } 116 | 117 | #pragma mark - Cancel 118 | 119 | - (void)sd_cancelCurrentImageLoad { 120 | [self sd_cancelImageLoadOperationWithKey:imageOperationKey()]; 121 | } 122 | 123 | - (void)sd_cancelCurrentAlternateImageLoad { 124 | [self sd_cancelImageLoadOperationWithKey:alternateImageOperationKey()]; 125 | } 126 | 127 | #pragma mar - Private 128 | 129 | - (NSURL *)sd_currentImageURL { 130 | return objc_getAssociatedObject(self, @selector(sd_currentImageURL)); 131 | } 132 | 133 | - (void)setSd_currentImageURL:(NSURL *)sd_currentImageURL { 134 | objc_setAssociatedObject(self, @selector(sd_currentImageURL), sd_currentImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 135 | } 136 | 137 | - (NSURL *)sd_currentAlternateImageURL { 138 | return objc_getAssociatedObject(self, @selector(sd_currentAlternateImageURL)); 139 | } 140 | 141 | - (void)setSd_currentAlternateImageURL:(NSURL *)sd_currentAlternateImageURL { 142 | objc_setAssociatedObject(self, @selector(sd_currentAlternateImageURL), sd_currentAlternateImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 143 | } 144 | 145 | @end 146 | 147 | #endif 148 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+WebCache.h" 10 | #import "objc/runtime.h" 11 | #import "UIView+WebCacheOperation.h" 12 | #import "UIView+WebCache.h" 13 | 14 | @implementation UIImageView (WebCache) 15 | 16 | - (void)sd_setImageWithURL:(nullable NSURL *)url { 17 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; 18 | } 19 | 20 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { 21 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; 22 | } 23 | 24 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 25 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; 26 | } 27 | 28 | - (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 29 | [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; 30 | } 31 | 32 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 33 | [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; 34 | } 35 | 36 | - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 37 | [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; 38 | } 39 | 40 | - (void)sd_setImageWithURL:(nullable NSURL *)url 41 | placeholderImage:(nullable UIImage *)placeholder 42 | options:(SDWebImageOptions)options 43 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 44 | completed:(nullable SDExternalCompletionBlock)completedBlock { 45 | [self sd_internalSetImageWithURL:url 46 | placeholderImage:placeholder 47 | options:options 48 | operationKey:nil 49 | setImageBlock:nil 50 | progress:progressBlock 51 | completed:completedBlock]; 52 | } 53 | 54 | - (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url 55 | placeholderImage:(nullable UIImage *)placeholder 56 | options:(SDWebImageOptions)options 57 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 58 | completed:(nullable SDExternalCompletionBlock)completedBlock { 59 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url]; 60 | UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromCacheForKey:key]; 61 | 62 | [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock]; 63 | } 64 | 65 | #if SD_UIKIT 66 | 67 | #pragma mark - Animation of multiple images 68 | 69 | - (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs { 70 | [self sd_cancelCurrentAnimationImagesLoad]; 71 | NSPointerArray *operationsArray = [self sd_animationOperationArray]; 72 | 73 | [arrayOfURLs enumerateObjectsUsingBlock:^(NSURL *logoImageURL, NSUInteger idx, BOOL * _Nonnull stop) { 74 | __weak __typeof(self) wself = self; 75 | id operation = [[SDWebImageManager sharedManager] loadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 76 | __strong typeof(wself) sself = wself; 77 | if (!sself) return; 78 | dispatch_main_async_safe(^{ 79 | [sself stopAnimating]; 80 | if (sself && image) { 81 | NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; 82 | if (!currentImages) { 83 | currentImages = [[NSMutableArray alloc] init]; 84 | } 85 | 86 | // We know what index objects should be at when they are returned so 87 | // we will put the object at the index, filling any empty indexes 88 | // with the image that was returned too "early". These images will 89 | // be overwritten. (does not require additional sorting datastructure) 90 | while ([currentImages count] < idx) { 91 | [currentImages addObject:image]; 92 | } 93 | 94 | currentImages[idx] = image; 95 | 96 | sself.animationImages = currentImages; 97 | [sself setNeedsLayout]; 98 | } 99 | [sself startAnimating]; 100 | }); 101 | }]; 102 | @synchronized (self) { 103 | [operationsArray addPointer:(__bridge void *)(operation)]; 104 | } 105 | }]; 106 | } 107 | 108 | static char animationLoadOperationKey; 109 | 110 | // element is weak because operation instance is retained by SDWebImageManager's runningOperations property 111 | // we should use lock to keep thread-safe because these method may not be acessed from main queue 112 | - (NSPointerArray *)sd_animationOperationArray { 113 | @synchronized(self) { 114 | NSPointerArray *operationsArray = objc_getAssociatedObject(self, &animationLoadOperationKey); 115 | if (operationsArray) { 116 | return operationsArray; 117 | } 118 | operationsArray = [NSPointerArray weakObjectsPointerArray]; 119 | objc_setAssociatedObject(self, &animationLoadOperationKey, operationsArray, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 120 | return operationsArray; 121 | } 122 | } 123 | 124 | - (void)sd_cancelCurrentAnimationImagesLoad { 125 | NSPointerArray *operationsArray = [self sd_animationOperationArray]; 126 | if (operationsArray) { 127 | @synchronized (self) { 128 | for (id operation in operationsArray) { 129 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { 130 | [operation cancel]; 131 | } 132 | } 133 | operationsArray.count = 0; 134 | } 135 | } 136 | } 137 | #endif 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Tests/Pods-OTTOPhotoBrowser_Tests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 80 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 145 | wait 146 | fi 147 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/SDWebImageGIFCoder.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 "SDWebImageGIFCoder.h" 10 | #import "NSImage+WebCache.h" 11 | #import 12 | #import "NSData+ImageContentType.h" 13 | #import "UIImage+MultiFormat.h" 14 | #import "SDWebImageCoderHelper.h" 15 | #import "SDAnimatedImageRep.h" 16 | 17 | @implementation SDWebImageGIFCoder 18 | 19 | + (instancetype)sharedCoder { 20 | static SDWebImageGIFCoder *coder; 21 | static dispatch_once_t onceToken; 22 | dispatch_once(&onceToken, ^{ 23 | coder = [[SDWebImageGIFCoder alloc] init]; 24 | }); 25 | return coder; 26 | } 27 | 28 | #pragma mark - Decode 29 | - (BOOL)canDecodeFromData:(nullable NSData *)data { 30 | return ([NSData sd_imageFormatForImageData:data] == SDImageFormatGIF); 31 | } 32 | 33 | - (UIImage *)decodedImageWithData:(NSData *)data { 34 | if (!data) { 35 | return nil; 36 | } 37 | 38 | #if SD_MAC 39 | SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; 40 | NSImage *animatedImage = [[NSImage alloc] initWithSize:imageRep.size]; 41 | [animatedImage addRepresentation:imageRep]; 42 | return animatedImage; 43 | #else 44 | 45 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); 46 | if (!source) { 47 | return nil; 48 | } 49 | size_t count = CGImageSourceGetCount(source); 50 | 51 | UIImage *animatedImage; 52 | 53 | if (count <= 1) { 54 | animatedImage = [[UIImage alloc] initWithData:data]; 55 | } else { 56 | NSMutableArray *frames = [NSMutableArray array]; 57 | 58 | for (size_t i = 0; i < count; i++) { 59 | CGImageRef imageRef = CGImageSourceCreateImageAtIndex(source, i, NULL); 60 | if (!imageRef) { 61 | continue; 62 | } 63 | 64 | float duration = [self sd_frameDurationAtIndex:i source:source]; 65 | UIImage *image = [[UIImage alloc] initWithCGImage:imageRef]; 66 | CGImageRelease(imageRef); 67 | 68 | SDWebImageFrame *frame = [SDWebImageFrame frameWithImage:image duration:duration]; 69 | [frames addObject:frame]; 70 | } 71 | 72 | NSUInteger loopCount = 1; 73 | NSDictionary *imageProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(source, nil); 74 | NSDictionary *gifProperties = [imageProperties valueForKey:(__bridge NSString *)kCGImagePropertyGIFDictionary]; 75 | if (gifProperties) { 76 | NSNumber *gifLoopCount = [gifProperties valueForKey:(__bridge NSString *)kCGImagePropertyGIFLoopCount]; 77 | if (gifLoopCount != nil) { 78 | loopCount = gifLoopCount.unsignedIntegerValue; 79 | } 80 | } 81 | 82 | animatedImage = [SDWebImageCoderHelper animatedImageWithFrames:frames]; 83 | animatedImage.sd_imageLoopCount = loopCount; 84 | animatedImage.sd_imageFormat = SDImageFormatGIF; 85 | } 86 | 87 | CFRelease(source); 88 | 89 | return animatedImage; 90 | #endif 91 | } 92 | 93 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { 94 | float frameDuration = 0.1f; 95 | CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); 96 | if (!cfFrameProperties) { 97 | return frameDuration; 98 | } 99 | NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; 100 | NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary]; 101 | 102 | NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime]; 103 | if (delayTimeUnclampedProp != nil) { 104 | frameDuration = [delayTimeUnclampedProp floatValue]; 105 | } else { 106 | NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime]; 107 | if (delayTimeProp != nil) { 108 | frameDuration = [delayTimeProp floatValue]; 109 | } 110 | } 111 | 112 | // Many annoying ads specify a 0 duration to make an image flash as quickly as possible. 113 | // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify 114 | // a duration of <= 10 ms. See and 115 | // for more information. 116 | 117 | if (frameDuration < 0.011f) { 118 | frameDuration = 0.100f; 119 | } 120 | 121 | CFRelease(cfFrameProperties); 122 | return frameDuration; 123 | } 124 | 125 | - (UIImage *)decompressedImageWithImage:(UIImage *)image 126 | data:(NSData *__autoreleasing _Nullable *)data 127 | options:(nullable NSDictionary*)optionsDict { 128 | // GIF do not decompress 129 | return image; 130 | } 131 | 132 | #pragma mark - Encode 133 | - (BOOL)canEncodeToFormat:(SDImageFormat)format { 134 | return (format == SDImageFormatGIF); 135 | } 136 | 137 | - (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format { 138 | if (!image) { 139 | return nil; 140 | } 141 | 142 | if (format != SDImageFormatGIF) { 143 | return nil; 144 | } 145 | 146 | NSMutableData *imageData = [NSMutableData data]; 147 | CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatGIF]; 148 | NSArray *frames = [SDWebImageCoderHelper framesFromAnimatedImage:image]; 149 | 150 | // Create an image destination. GIF does not support EXIF image orientation 151 | CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count, NULL); 152 | if (!imageDestination) { 153 | // Handle failure. 154 | return nil; 155 | } 156 | if (frames.count == 0) { 157 | // for static single GIF images 158 | CGImageDestinationAddImage(imageDestination, image.CGImage, nil); 159 | } else { 160 | // for animated GIF images 161 | NSUInteger loopCount = image.sd_imageLoopCount; 162 | NSDictionary *gifProperties = @{(__bridge NSString *)kCGImagePropertyGIFDictionary: @{(__bridge NSString *)kCGImagePropertyGIFLoopCount : @(loopCount)}}; 163 | CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)gifProperties); 164 | 165 | for (size_t i = 0; i < frames.count; i++) { 166 | SDWebImageFrame *frame = frames[i]; 167 | float frameDuration = frame.duration; 168 | CGImageRef frameImageRef = frame.image.CGImage; 169 | NSDictionary *frameProperties = @{(__bridge NSString *)kCGImagePropertyGIFDictionary : @{(__bridge NSString *)kCGImagePropertyGIFDelayTime : @(frameDuration)}}; 170 | CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)frameProperties); 171 | } 172 | } 173 | // Finalize the destination. 174 | if (CGImageDestinationFinalize(imageDestination) == NO) { 175 | // Handle failure. 176 | imageData = nil; 177 | } 178 | 179 | CFRelease(imageDestination); 180 | 181 | return [imageData copy]; 182 | } 183 | 184 | @end 185 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIView+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "SDWebImageManager.h" 11 | #import "SDWebImageTransition.h" 12 | 13 | /** 14 | A Dispatch group to maintain setImageBlock and completionBlock. This key should be used only internally and may be changed in the future. (dispatch_group_t) 15 | */ 16 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageInternalSetImageGroupKey __deprecated_msg("Key Deprecated. Does nothing. This key should be used only internally"); 17 | /** 18 | A SDWebImageManager instance to control the image download and cache process using in UIImageView+WebCache category and likes. If not provided, use the shared manager (SDWebImageManager) 19 | */ 20 | FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageExternalCustomManagerKey; 21 | /** 22 | The value specify that the image progress unit count cannot be determined because the progressBlock is not been called. 23 | */ 24 | FOUNDATION_EXPORT const int64_t SDWebImageProgressUnitCountUnknown; /* 1LL */ 25 | 26 | typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData); 27 | 28 | @interface UIView (WebCache) 29 | 30 | /** 31 | * Get the current image URL. 32 | * 33 | * @note Note that because of the limitations of categories this property can get out of sync if you use setImage: directly. 34 | */ 35 | - (nullable NSURL *)sd_imageURL; 36 | 37 | /** 38 | * The current image loading progress associated to the view. The unit count is the received size and excepted size of download. 39 | * The `totalUnitCount` and `completedUnitCount` will be reset to 0 after a new image loading start (change from current queue). And they will be set to `SDWebImageProgressUnitCountUnknown` if the progressBlock not been called but the image loading success to mark the progress finished (change from main queue). 40 | * @note You can use Key-Value Observing on the progress, but you should take care that the change to progress is from a background queue during download(the same as progressBlock). If you want to using KVO and update the UI, make sure to dispatch on the main queue. And it's recommand to use some KVO libs like KVOController because it's more safe and easy to use. 41 | * @note The getter will create a progress instance if the value is nil. You can also set a custom progress instance and let it been updated during image loading 42 | * @note Note that because of the limitations of categories this property can get out of sync if you update the progress directly. 43 | */ 44 | @property (nonatomic, strong, null_resettable) NSProgress *sd_imageProgress; 45 | 46 | /** 47 | * Set the imageView `image` with an `url` and optionally a placeholder image. 48 | * 49 | * The download is asynchronous and cached. 50 | * 51 | * @param url The url for the image. 52 | * @param placeholder The image to be set initially, until the image request finishes. 53 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 54 | * @param operationKey A string to be used as the operation key. If nil, will use the class name 55 | * @param setImageBlock Block used for custom set image code 56 | * @param progressBlock A block called while image is downloading 57 | * @note the progress block is executed on a background queue 58 | * @param completedBlock A block called when operation has been completed. This block has no return value 59 | * and takes the requested UIImage as first parameter. In case of error the image parameter 60 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 61 | * indicating if the image was retrieved from the local cache or from the network. 62 | * The fourth parameter is the original image url. 63 | */ 64 | - (void)sd_internalSetImageWithURL:(nullable NSURL *)url 65 | placeholderImage:(nullable UIImage *)placeholder 66 | options:(SDWebImageOptions)options 67 | operationKey:(nullable NSString *)operationKey 68 | setImageBlock:(nullable SDSetImageBlock)setImageBlock 69 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 70 | completed:(nullable SDExternalCompletionBlock)completedBlock; 71 | 72 | /** 73 | * Set the imageView `image` with an `url` and optionally a placeholder image. 74 | * 75 | * The download is asynchronous and cached. 76 | * 77 | * @param url The url for the image. 78 | * @param placeholder The image to be set initially, until the image request finishes. 79 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 80 | * @param operationKey A string to be used as the operation key. If nil, will use the class name 81 | * @param setImageBlock Block used for custom set image code 82 | * @param progressBlock A block called while image is downloading 83 | * @note the progress block is executed on a background queue 84 | * @param completedBlock A block called when operation has been completed. This block has no return value 85 | * and takes the requested UIImage as first parameter. In case of error the image parameter 86 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 87 | * indicating if the image was retrieved from the local cache or from the network. 88 | * The fourth parameter is the original image url. 89 | * @param context A context with extra information to perform specify changes or processes. 90 | */ 91 | - (void)sd_internalSetImageWithURL:(nullable NSURL *)url 92 | placeholderImage:(nullable UIImage *)placeholder 93 | options:(SDWebImageOptions)options 94 | operationKey:(nullable NSString *)operationKey 95 | setImageBlock:(nullable SDSetImageBlock)setImageBlock 96 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 97 | completed:(nullable SDExternalCompletionBlock)completedBlock 98 | context:(nullable NSDictionary *)context; 99 | 100 | /** 101 | * Cancel the current image load 102 | */ 103 | - (void)sd_cancelCurrentImageLoad; 104 | 105 | #if SD_UIKIT || SD_MAC 106 | 107 | #pragma mark - Image Transition 108 | 109 | /** 110 | The image transition when image load finished. See `SDWebImageTransition`. 111 | If you specify nil, do not do transition. Defautls to nil. 112 | */ 113 | @property (nonatomic, strong, nullable) SDWebImageTransition *sd_imageTransition; 114 | 115 | #if SD_UIKIT 116 | 117 | #pragma mark - Activity indicator 118 | 119 | /** 120 | * Show activity UIActivityIndicatorView 121 | */ 122 | - (void)sd_setShowActivityIndicatorView:(BOOL)show; 123 | 124 | /** 125 | * set desired UIActivityIndicatorViewStyle 126 | * 127 | * @param style The style of the UIActivityIndicatorView 128 | */ 129 | - (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style; 130 | 131 | - (BOOL)sd_showActivityIndicatorView; 132 | - (void)sd_addActivityIndicator; 133 | - (void)sd_removeActivityIndicator; 134 | 135 | #endif 136 | 137 | #endif 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OTTOPhotoBrowser_Example/Pods-OTTOPhotoBrowser_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 80 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | 145 | if [[ "$CONFIGURATION" == "Debug" ]]; then 146 | install_framework "${BUILT_PRODUCTS_DIR}/OTTOPhotoBrowser/OTTOPhotoBrowser.framework" 147 | install_framework "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework" 148 | fi 149 | if [[ "$CONFIGURATION" == "Release" ]]; then 150 | install_framework "${BUILT_PRODUCTS_DIR}/OTTOPhotoBrowser/OTTOPhotoBrowser.framework" 151 | install_framework "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework" 152 | fi 153 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 154 | wait 155 | fi 156 | -------------------------------------------------------------------------------- /OTTOPhotoBrowser/Classes/OTTOZoomingScrollView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OttoZoomingScrollView.swift 3 | // OTTOPhotoBrowser 4 | // 5 | // Created by Lukas Zielinski on 22/12/2016. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class OTTOZoomingScrollView: UIScrollView, UIScrollViewDelegate { 12 | 13 | var photo: OTTOPhoto? { 14 | didSet { 15 | displayImage() 16 | } 17 | } 18 | 19 | var padding: CGFloat = 0 20 | weak var photoBrowserView: OTTOPhotoBrowserView? 21 | private let activityIndicatorView: UIActivityIndicatorView 22 | private let tapView: UIView 23 | private let photoImageView: UIImageView 24 | private var isPinchoutDetected = false 25 | 26 | func prepareForReuse() { 27 | photo = nil 28 | } 29 | 30 | required init?(coder aDecoder: NSCoder) { 31 | fatalError("init(coder:) has not been implemented") 32 | } 33 | 34 | init(photoBrowserView: OTTOPhotoBrowserView) { 35 | self.photoBrowserView = photoBrowserView 36 | 37 | activityIndicatorView = UIActivityIndicatorView() 38 | tapView = UIView(frame: CGRect.zero) 39 | photoImageView = UIImageView(frame: CGRect.zero) 40 | 41 | super.init(frame: CGRect.zero) 42 | 43 | activityIndicatorView.style = .gray 44 | activityIndicatorView.hidesWhenStopped = true 45 | addSubview(activityIndicatorView) 46 | 47 | tapView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 48 | tapView.backgroundColor = UIColor.clear 49 | let tapViewSingleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleSingleTap(gestureRecognizer:))) 50 | let tapViewDoubleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(gestureRecognizer:))) 51 | tapViewDoubleTapRecognizer.numberOfTapsRequired = 2 52 | tapViewSingleTapRecognizer.require(toFail: tapViewDoubleTapRecognizer) 53 | tapView.addGestureRecognizer(tapViewSingleTapRecognizer) 54 | tapView.addGestureRecognizer(tapViewDoubleTapRecognizer) 55 | 56 | photoImageView.backgroundColor = UIColor.clear 57 | let imageViewSingleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleSingleTap(gestureRecognizer:))) 58 | let imageViewDoubleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(gestureRecognizer:))) 59 | imageViewDoubleTapRecognizer.numberOfTapsRequired = 2 60 | imageViewSingleTapRecognizer.require(toFail: imageViewDoubleTapRecognizer) 61 | photoImageView.contentMode = .scaleAspectFit 62 | photoImageView.isUserInteractionEnabled = true 63 | photoImageView.addGestureRecognizer(imageViewSingleTapRecognizer) 64 | photoImageView.addGestureRecognizer(imageViewDoubleTapRecognizer) 65 | addSubview(tapView) 66 | addSubview(photoImageView) 67 | 68 | backgroundColor = UIColor.clear 69 | delegate = self 70 | showsVerticalScrollIndicator = false 71 | showsHorizontalScrollIndicator = false 72 | decelerationRate = UIScrollView.DecelerationRate.fast 73 | autoresizingMask = [.flexibleHeight, .flexibleWidth] 74 | } 75 | 76 | func displayImage() { 77 | guard let photo = photo else { 78 | return 79 | } 80 | 81 | if let image = photoBrowserView?.imageForPhoto(photo: photo), image.size.width > 0, image.size.height > 0 { 82 | minimumZoomScale = 1 83 | maximumZoomScale = 1 84 | zoomScale = 1 85 | 86 | photoImageView.image = image 87 | photoImageView.isHidden = false 88 | 89 | photoImageView.frame = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height) 90 | contentSize = photoImageView.frame.size 91 | 92 | setMaxMinZoomScalesForCurrentBounds() 93 | activityIndicatorView.stopAnimating() 94 | } else { 95 | photoImageView.isHidden = true 96 | activityIndicatorView.startAnimating() 97 | } 98 | setNeedsLayout() 99 | } 100 | 101 | private func setMaxMinZoomScalesForCurrentBounds() { 102 | if photoImageView.image == nil { 103 | return 104 | } 105 | 106 | var boundsSize = bounds.size 107 | boundsSize.width -= 0.1 108 | boundsSize.height -= 0.1 109 | 110 | let imageSize = photoImageView.frame.size 111 | 112 | let xScale = boundsSize.width / imageSize.width; // the scale needed to perfectly fit the image width-wise 113 | let yScale = boundsSize.height / imageSize.height; // the scale needed to perfectly fit the image height-wise 114 | let minScale = min(xScale, yScale); // use minimum of these to allow the image to become fully visible 115 | let maxScale = minScale * 2.5 116 | 117 | maximumZoomScale = maxScale; 118 | minimumZoomScale = minScale; 119 | zoomScale = minScale; 120 | 121 | let paddingX = photoImageView.frame.size.width > padding * 4 ? padding : 0 122 | let paddingY = photoImageView.frame.size.height > padding * 4 ? padding : 0 123 | 124 | photoImageView.frame = CGRect(x: 0, y: 0, width: photoImageView.frame.size.width, height: photoImageView.frame.size.height).insetBy(dx: paddingX, dy: paddingY) 125 | 126 | setNeedsLayout() 127 | } 128 | 129 | override func layoutSubviews() { 130 | tapView.frame = bounds 131 | 132 | super.layoutSubviews() 133 | 134 | let boundsSize = bounds.size 135 | var frameToCenter = photoImageView.frame 136 | 137 | if frameToCenter.size.width < boundsSize.width { 138 | frameToCenter.origin.x = floor((boundsSize.width - frameToCenter.size.width) / CGFloat(2)) 139 | } else { 140 | frameToCenter.origin.x = 0; 141 | } 142 | 143 | if frameToCenter.size.height < boundsSize.height { 144 | frameToCenter.origin.y = floor((boundsSize.height - frameToCenter.size.height) / CGFloat(2)); 145 | } else { 146 | frameToCenter.origin.y = 0; 147 | } 148 | 149 | photoImageView.frame = frameToCenter 150 | 151 | activityIndicatorView.center = CGPoint(x: bounds.midX, y: bounds.midY) 152 | } 153 | 154 | // MARK: UIScrollViewDelegate 155 | 156 | func viewForZooming(in scrollView: UIScrollView) -> UIView? { 157 | return photoImageView 158 | } 159 | 160 | func scrollViewDidZoom(_ scrollView: UIScrollView) { 161 | setNeedsLayout() 162 | layoutIfNeeded() 163 | if zoomScale < (minimumZoomScale - minimumZoomScale * 0.4) { 164 | isPinchoutDetected = true 165 | } 166 | } 167 | 168 | func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) { 169 | photoBrowserView?.scrollViewDidEndZooming(scrollView, with: view, atScale: scale) 170 | if isPinchoutDetected { 171 | isPinchoutDetected = false 172 | photoBrowserView?.onPinchout() 173 | } 174 | } 175 | 176 | // MARK: Tap Detection 177 | 178 | @objc func handleSingleTap(gestureRecognizer: UITapGestureRecognizer) { 179 | photoBrowserView?.onTap() 180 | } 181 | 182 | @objc func handleDoubleTap(gestureRecognizer: UITapGestureRecognizer) { 183 | let touchPoint = gestureRecognizer.location(in: photoImageView) 184 | if zoomScale == maximumZoomScale { 185 | setZoomScale(minimumZoomScale, animated: true) 186 | } else { 187 | zoom(to: CGRect(x: touchPoint.x, y: touchPoint.y, width: 1, height: 1), animated: true) 188 | } 189 | 190 | photoBrowserView?.onZoomedWithDoubleTap() 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /Example/Pods/SDWebImage/SDWebImage/UIButton+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIButton+WebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "objc/runtime.h" 14 | #import "UIView+WebCacheOperation.h" 15 | #import "UIView+WebCache.h" 16 | 17 | static char imageURLStorageKey; 18 | 19 | typedef NSMutableDictionary SDStateImageURLDictionary; 20 | 21 | static inline NSString * imageURLKeyForState(UIControlState state) { 22 | return [NSString stringWithFormat:@"image_%lu", (unsigned long)state]; 23 | } 24 | 25 | static inline NSString * backgroundImageURLKeyForState(UIControlState state) { 26 | return [NSString stringWithFormat:@"backgroundImage_%lu", (unsigned long)state]; 27 | } 28 | 29 | static inline NSString * imageOperationKeyForState(UIControlState state) { 30 | return [NSString stringWithFormat:@"UIButtonImageOperation%lu", (unsigned long)state]; 31 | } 32 | 33 | static inline NSString * backgroundImageOperationKeyForState(UIControlState state) { 34 | return [NSString stringWithFormat:@"UIButtonBackgroundImageOperation%lu", (unsigned long)state]; 35 | } 36 | 37 | @implementation UIButton (WebCache) 38 | 39 | #pragma mark - Image 40 | 41 | - (nullable NSURL *)sd_currentImageURL { 42 | NSURL *url = self.sd_imageURLStorage[imageURLKeyForState(self.state)]; 43 | 44 | if (!url) { 45 | url = self.sd_imageURLStorage[imageURLKeyForState(UIControlStateNormal)]; 46 | } 47 | 48 | return url; 49 | } 50 | 51 | - (nullable NSURL *)sd_imageURLForState:(UIControlState)state { 52 | return self.sd_imageURLStorage[imageURLKeyForState(state)]; 53 | } 54 | 55 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { 56 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 57 | } 58 | 59 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { 60 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 61 | } 62 | 63 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 64 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 65 | } 66 | 67 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { 68 | [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; 69 | } 70 | 71 | - (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 72 | [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; 73 | } 74 | 75 | - (void)sd_setImageWithURL:(nullable NSURL *)url 76 | forState:(UIControlState)state 77 | placeholderImage:(nullable UIImage *)placeholder 78 | options:(SDWebImageOptions)options 79 | completed:(nullable SDExternalCompletionBlock)completedBlock { 80 | if (!url) { 81 | [self.sd_imageURLStorage removeObjectForKey:imageURLKeyForState(state)]; 82 | } else { 83 | self.sd_imageURLStorage[imageURLKeyForState(state)] = url; 84 | } 85 | 86 | __weak typeof(self)weakSelf = self; 87 | [self sd_internalSetImageWithURL:url 88 | placeholderImage:placeholder 89 | options:options 90 | operationKey:imageOperationKeyForState(state) 91 | setImageBlock:^(UIImage *image, NSData *imageData) { 92 | [weakSelf setImage:image forState:state]; 93 | } 94 | progress:nil 95 | completed:completedBlock]; 96 | } 97 | 98 | #pragma mark - Background Image 99 | 100 | - (nullable NSURL *)sd_currentBackgroundImageURL { 101 | NSURL *url = self.sd_imageURLStorage[backgroundImageURLKeyForState(self.state)]; 102 | 103 | if (!url) { 104 | url = self.sd_imageURLStorage[backgroundImageURLKeyForState(UIControlStateNormal)]; 105 | } 106 | 107 | return url; 108 | } 109 | 110 | - (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state { 111 | return self.sd_imageURLStorage[backgroundImageURLKeyForState(state)]; 112 | } 113 | 114 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { 115 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; 116 | } 117 | 118 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { 119 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; 120 | } 121 | 122 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { 123 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; 124 | } 125 | 126 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { 127 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; 128 | } 129 | 130 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { 131 | [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; 132 | } 133 | 134 | - (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url 135 | forState:(UIControlState)state 136 | placeholderImage:(nullable UIImage *)placeholder 137 | options:(SDWebImageOptions)options 138 | completed:(nullable SDExternalCompletionBlock)completedBlock { 139 | if (!url) { 140 | [self.sd_imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)]; 141 | } else { 142 | self.sd_imageURLStorage[backgroundImageURLKeyForState(state)] = url; 143 | } 144 | 145 | __weak typeof(self)weakSelf = self; 146 | [self sd_internalSetImageWithURL:url 147 | placeholderImage:placeholder 148 | options:options 149 | operationKey:backgroundImageOperationKeyForState(state) 150 | setImageBlock:^(UIImage *image, NSData *imageData) { 151 | [weakSelf setBackgroundImage:image forState:state]; 152 | } 153 | progress:nil 154 | completed:completedBlock]; 155 | } 156 | 157 | #pragma mark - Cancel 158 | 159 | - (void)sd_cancelImageLoadForState:(UIControlState)state { 160 | [self sd_cancelImageLoadOperationWithKey:imageOperationKeyForState(state)]; 161 | } 162 | 163 | - (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { 164 | [self sd_cancelImageLoadOperationWithKey:backgroundImageOperationKeyForState(state)]; 165 | } 166 | 167 | #pragma mark - Private 168 | 169 | - (SDStateImageURLDictionary *)sd_imageURLStorage { 170 | SDStateImageURLDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey); 171 | if (!storage) { 172 | storage = [NSMutableDictionary dictionary]; 173 | objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 174 | } 175 | 176 | return storage; 177 | } 178 | 179 | @end 180 | 181 | #endif 182 | --------------------------------------------------------------------------------