├── .gitattributes
├── .github
├── CONTRIBUTING.md
├── FUNDING.yml
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
├── stale.yml
└── workflows
│ ├── CD.yml
│ └── CI.yml
├── .gitignore
├── .swiftpm
└── xcode
│ └── package.xcworkspace
│ └── contents.xcworkspacedata
├── CHANGELOG.md
├── Certificate
├── SDWebImage Signing Certificate.cer
└── SDWebImage Signing Certificate.pem
├── Configs
├── App-Debug.xcconfig
├── App-Release.xcconfig
├── App-Shared.xcconfig
├── Dynamic.xcconfig
├── Module-Debug.xcconfig
├── Module-Release.xcconfig
├── Module-Shared.xcconfig
├── Static.xcconfig
├── Test-Debug.xcconfig
├── Test-Release.xcconfig
└── Test-Shared.xcconfig
├── Docs
├── API-Diff
│ └── 5.0
│ │ ├── apidiff.css
│ │ └── apidiff.html
├── Diagrams
│ ├── SDWebImage.mdj
│ ├── SDWebImageCacheClassDiagram.png
│ ├── SDWebImageClassDiagram.png
│ ├── SDWebImageCodersClassDiagram.png
│ ├── SDWebImageHighLevelDiagram.jpeg
│ ├── SDWebImageLoaderClassDiagram.png
│ ├── SDWebImageManagerClassDiagram.png
│ ├── SDWebImageSequenceDiagram.png
│ └── SDWebImageTopLevelClassDiagram.png
├── HowToUse.md
├── ManualInstallation.md
├── SDWebImage-4.0-Migration-guide.md
└── SDWebImage-5.0-Migration-guide.md
├── Examples
├── CustomPathImages
│ └── 4ad9ae8eabfec60b40bf48f0bfc2d120
├── Packages
│ └── RealityKitContent
│ │ ├── Package.realitycomposerpro
│ │ ├── ProjectData
│ │ │ └── main.json
│ │ └── WorkspaceData
│ │ │ ├── SceneMetadataList.json
│ │ │ └── Settings.rcprojectdata
│ │ ├── Package.swift
│ │ ├── README.md
│ │ └── Sources
│ │ └── RealityKitContent
│ │ ├── RealityKitContent.rkassets
│ │ ├── Materials
│ │ │ └── GridMaterial.usda
│ │ └── Scene.usda
│ │ └── RealityKitContent.swift
├── SDWebImage Demo.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── SDWebImage OSX Demo.xcscheme
│ │ ├── SDWebImage TV Demo.xcscheme
│ │ ├── SDWebImage Vision Demo.xcscheme
│ │ ├── SDWebImage Watch Demo.xcscheme
│ │ └── SDWebImage iOS Demo.xcscheme
├── SDWebImage Demo
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ └── placeholder.imageset
│ │ │ ├── Contents.json
│ │ │ ├── placeholder.png
│ │ │ └── placeholder@2x.png
│ ├── DetailViewController.h
│ ├── DetailViewController.m
│ ├── Info.plist
│ ├── LaunchScreen.storyboard
│ ├── MasterViewController.h
│ ├── MasterViewController.m
│ ├── en.lproj
│ │ ├── DetailViewController.xib
│ │ └── MasterViewController.xib
│ └── main.m
├── SDWebImage OSX Demo
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Base.lproj
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── WindowController.h
│ ├── WindowController.m
│ └── main.m
├── SDWebImage TV Demo
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── App Icon & Top Shelf Image.brandassets
│ │ │ ├── App Icon - Large.imagestack
│ │ │ │ ├── Back.imagestacklayer
│ │ │ │ │ ├── Content.imageset
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Front.imagestacklayer
│ │ │ │ │ ├── Content.imageset
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Middle.imagestacklayer
│ │ │ │ │ ├── Content.imageset
│ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ ├── App Icon - Small.imagestack
│ │ │ │ ├── Back.imagestacklayer
│ │ │ │ │ ├── Content.imageset
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Front.imagestacklayer
│ │ │ │ │ ├── Content.imageset
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Middle.imagestacklayer
│ │ │ │ │ ├── Content.imageset
│ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ ├── Top Shelf Image Wide.imageset
│ │ │ │ └── Contents.json
│ │ │ └── Top Shelf Image.imageset
│ │ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── SDWebImage Vision Demo
│ ├── App.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.solidimagestack
│ │ │ ├── Back.solidimagestacklayer
│ │ │ │ ├── Content.imageset
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ │ ├── Contents.json
│ │ │ ├── Front.solidimagestacklayer
│ │ │ │ ├── Content.imageset
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ │ └── Middle.solidimagestacklayer
│ │ │ │ ├── Content.imageset
│ │ │ │ └── Contents.json
│ │ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── ContentView.swift
│ ├── DetailView.swift
│ ├── Info.plist
│ └── Preview Content
│ │ └── Preview Assets.xcassets
│ │ └── Contents.json
├── SDWebImage Watch Demo Extension
│ ├── Assets.xcassets
│ │ └── README__ignoredByTemplate__
│ ├── ExtensionDelegate.h
│ ├── ExtensionDelegate.m
│ ├── Info.plist
│ ├── InterfaceController.h
│ ├── InterfaceController.m
│ ├── NotificationController.h
│ ├── NotificationController.m
│ └── PushNotificationPayload.apns
└── SDWebImage Watch Demo
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ └── Interface.storyboard
│ └── Info.plist
├── LICENSE
├── Package.swift
├── Podfile
├── README.md
├── SDWebImage.json
├── SDWebImage.podspec
├── SDWebImage.xcodeproj
├── project.pbxproj
└── xcshareddata
│ └── xcschemes
│ ├── SDWebImage XCFramework.xcscheme
│ ├── SDWebImage static.xcscheme
│ ├── SDWebImage.xcscheme
│ └── SDWebImageMapKit.xcscheme
├── SDWebImage.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ └── WorkspaceSettings.xcsettings
├── SDWebImage
├── Core
│ ├── NSButton+WebCache.h
│ ├── NSButton+WebCache.m
│ ├── NSData+ImageContentType.h
│ ├── NSData+ImageContentType.m
│ ├── NSImage+Compatibility.h
│ ├── NSImage+Compatibility.m
│ ├── SDAnimatedImage.h
│ ├── SDAnimatedImage.m
│ ├── SDAnimatedImagePlayer.h
│ ├── SDAnimatedImagePlayer.m
│ ├── SDAnimatedImageRep.h
│ ├── SDAnimatedImageRep.m
│ ├── SDAnimatedImageView+WebCache.h
│ ├── SDAnimatedImageView+WebCache.m
│ ├── SDAnimatedImageView.h
│ ├── SDAnimatedImageView.m
│ ├── SDCallbackQueue.h
│ ├── SDCallbackQueue.m
│ ├── SDDiskCache.h
│ ├── SDDiskCache.m
│ ├── SDGraphicsImageRenderer.h
│ ├── SDGraphicsImageRenderer.m
│ ├── SDImageAPNGCoder.h
│ ├── SDImageAPNGCoder.m
│ ├── SDImageAWebPCoder.h
│ ├── SDImageAWebPCoder.m
│ ├── SDImageCache.h
│ ├── SDImageCache.m
│ ├── SDImageCacheConfig.h
│ ├── SDImageCacheConfig.m
│ ├── SDImageCacheDefine.h
│ ├── SDImageCacheDefine.m
│ ├── SDImageCachesManager.h
│ ├── SDImageCachesManager.m
│ ├── SDImageCoder.h
│ ├── SDImageCoder.m
│ ├── SDImageCoderHelper.h
│ ├── SDImageCoderHelper.m
│ ├── SDImageCodersManager.h
│ ├── SDImageCodersManager.m
│ ├── SDImageFrame.h
│ ├── SDImageFrame.m
│ ├── SDImageGIFCoder.h
│ ├── SDImageGIFCoder.m
│ ├── SDImageGraphics.h
│ ├── SDImageGraphics.m
│ ├── SDImageHEICCoder.h
│ ├── SDImageHEICCoder.m
│ ├── SDImageIOAnimatedCoder.h
│ ├── SDImageIOAnimatedCoder.m
│ ├── SDImageIOCoder.h
│ ├── SDImageIOCoder.m
│ ├── SDImageLoader.h
│ ├── SDImageLoader.m
│ ├── SDImageLoadersManager.h
│ ├── SDImageLoadersManager.m
│ ├── SDImageTransformer.h
│ ├── SDImageTransformer.m
│ ├── SDMemoryCache.h
│ ├── SDMemoryCache.m
│ ├── SDWebImageCacheKeyFilter.h
│ ├── SDWebImageCacheKeyFilter.m
│ ├── SDWebImageCacheSerializer.h
│ ├── SDWebImageCacheSerializer.m
│ ├── SDWebImageCompat.h
│ ├── SDWebImageCompat.m
│ ├── SDWebImageDefine.h
│ ├── SDWebImageDefine.m
│ ├── SDWebImageDownloader.h
│ ├── SDWebImageDownloader.m
│ ├── SDWebImageDownloaderConfig.h
│ ├── SDWebImageDownloaderConfig.m
│ ├── SDWebImageDownloaderDecryptor.h
│ ├── SDWebImageDownloaderDecryptor.m
│ ├── SDWebImageDownloaderOperation.h
│ ├── SDWebImageDownloaderOperation.m
│ ├── SDWebImageDownloaderRequestModifier.h
│ ├── SDWebImageDownloaderRequestModifier.m
│ ├── SDWebImageDownloaderResponseModifier.h
│ ├── SDWebImageDownloaderResponseModifier.m
│ ├── SDWebImageError.h
│ ├── SDWebImageError.m
│ ├── SDWebImageIndicator.h
│ ├── SDWebImageIndicator.m
│ ├── SDWebImageManager.h
│ ├── SDWebImageManager.m
│ ├── SDWebImageOperation.h
│ ├── SDWebImageOperation.m
│ ├── SDWebImageOptionsProcessor.h
│ ├── SDWebImageOptionsProcessor.m
│ ├── SDWebImagePrefetcher.h
│ ├── SDWebImagePrefetcher.m
│ ├── SDWebImageTransition.h
│ ├── SDWebImageTransition.m
│ ├── UIButton+WebCache.h
│ ├── UIButton+WebCache.m
│ ├── UIImage+ExtendedCacheData.h
│ ├── UIImage+ExtendedCacheData.m
│ ├── UIImage+ForceDecode.h
│ ├── UIImage+ForceDecode.m
│ ├── UIImage+GIF.h
│ ├── UIImage+GIF.m
│ ├── UIImage+MemoryCacheCost.h
│ ├── UIImage+MemoryCacheCost.m
│ ├── UIImage+Metadata.h
│ ├── UIImage+Metadata.m
│ ├── UIImage+MultiFormat.h
│ ├── UIImage+MultiFormat.m
│ ├── UIImage+Transform.h
│ ├── UIImage+Transform.m
│ ├── UIImageView+HighlightedWebCache.h
│ ├── UIImageView+HighlightedWebCache.m
│ ├── UIImageView+WebCache.h
│ ├── UIImageView+WebCache.m
│ ├── UIView+WebCache.h
│ ├── UIView+WebCache.m
│ ├── UIView+WebCacheOperation.h
│ ├── UIView+WebCacheOperation.m
│ ├── UIView+WebCacheState.h
│ └── UIView+WebCacheState.m
├── Private
│ ├── NSBezierPath+SDRoundedCorners.h
│ ├── NSBezierPath+SDRoundedCorners.m
│ ├── SDAssociatedObject.h
│ ├── SDAssociatedObject.m
│ ├── SDAsyncBlockOperation.h
│ ├── SDAsyncBlockOperation.m
│ ├── SDDeviceHelper.h
│ ├── SDDeviceHelper.m
│ ├── SDDisplayLink.h
│ ├── SDDisplayLink.m
│ ├── SDFileAttributeHelper.h
│ ├── SDFileAttributeHelper.m
│ ├── SDImageAssetManager.h
│ ├── SDImageAssetManager.m
│ ├── SDImageCachesManagerOperation.h
│ ├── SDImageCachesManagerOperation.m
│ ├── SDImageFramePool.h
│ ├── SDImageFramePool.m
│ ├── SDImageIOAnimatedCoderInternal.h
│ ├── SDInternalMacros.h
│ ├── SDInternalMacros.m
│ ├── SDWeakProxy.h
│ ├── SDWeakProxy.m
│ ├── SDWebImageTransitionInternal.h
│ ├── SDmetamacros.h
│ ├── UIColor+SDHexString.h
│ └── UIColor+SDHexString.m
├── Resources
│ └── PrivacyInfo.xcprivacy
└── include
│ └── SDWebImage
│ ├── NSButton+WebCache.h
│ ├── NSData+ImageContentType.h
│ ├── NSImage+Compatibility.h
│ ├── SDAnimatedImage.h
│ ├── SDAnimatedImagePlayer.h
│ ├── SDAnimatedImageRep.h
│ ├── SDAnimatedImageView+WebCache.h
│ ├── SDAnimatedImageView.h
│ ├── SDCallbackQueue.h
│ ├── SDDiskCache.h
│ ├── SDGraphicsImageRenderer.h
│ ├── SDImageAPNGCoder.h
│ ├── SDImageAWebPCoder.h
│ ├── SDImageCache.h
│ ├── SDImageCacheConfig.h
│ ├── SDImageCacheDefine.h
│ ├── SDImageCachesManager.h
│ ├── SDImageCoder.h
│ ├── SDImageCoderHelper.h
│ ├── SDImageCodersManager.h
│ ├── SDImageFrame.h
│ ├── SDImageGIFCoder.h
│ ├── SDImageGraphics.h
│ ├── SDImageHEICCoder.h
│ ├── SDImageIOAnimatedCoder.h
│ ├── SDImageIOCoder.h
│ ├── SDImageLoader.h
│ ├── SDImageLoadersManager.h
│ ├── SDImageTransformer.h
│ ├── SDMemoryCache.h
│ ├── SDWebImage.h
│ ├── SDWebImageCacheKeyFilter.h
│ ├── SDWebImageCacheSerializer.h
│ ├── SDWebImageCompat.h
│ ├── SDWebImageDefine.h
│ ├── SDWebImageDownloader.h
│ ├── SDWebImageDownloaderConfig.h
│ ├── SDWebImageDownloaderDecryptor.h
│ ├── SDWebImageDownloaderOperation.h
│ ├── SDWebImageDownloaderRequestModifier.h
│ ├── SDWebImageDownloaderResponseModifier.h
│ ├── SDWebImageError.h
│ ├── SDWebImageIndicator.h
│ ├── SDWebImageManager.h
│ ├── SDWebImageOperation.h
│ ├── SDWebImageOptionsProcessor.h
│ ├── SDWebImagePrefetcher.h
│ ├── SDWebImageTransition.h
│ ├── UIButton+WebCache.h
│ ├── UIImage+ExtendedCacheData.h
│ ├── UIImage+ForceDecode.h
│ ├── UIImage+GIF.h
│ ├── UIImage+MemoryCacheCost.h
│ ├── UIImage+Metadata.h
│ ├── UIImage+MultiFormat.h
│ ├── UIImage+Transform.h
│ ├── UIImageView+HighlightedWebCache.h
│ ├── UIImageView+WebCache.h
│ ├── UIView+WebCache.h
│ ├── UIView+WebCacheOperation.h
│ └── UIView+WebCacheState.h
├── SDWebImageMapKit
├── MapKit
│ ├── MKAnnotationView+WebCache.h
│ └── MKAnnotationView+WebCache.m
├── Resources
│ └── PrivacyInfo.xcprivacy
└── include
│ └── SDWebImageMapKit
│ ├── MKAnnotationView+WebCache.h
│ └── SDWebImageMapKit.h
├── SDWebImage_logo.png
├── SDWebImage_logo_small.png
├── Scripts
├── build-frameworks.sh
├── create-xcframework.sh
└── sign-xcframework.sh
├── Tests
├── Expecta.podspec
├── KVOController.podspec
├── SDWebImage Tests.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── Tests Mac.xcscheme
│ │ ├── Tests TV.xcscheme
│ │ ├── Tests Vision.xcscheme
│ │ └── Tests iOS.xcscheme
├── Tests Mac
│ └── Info.plist
├── Tests TV
│ └── Info.plist
├── Tests Vision
│ └── Info.plist
└── Tests
│ ├── Images
│ ├── 1@2x.gif
│ ├── IndexedPNG.png
│ ├── MonochromeTestImage.jpg
│ ├── RGBA16PNG.png
│ ├── TestAnimatedImageMemory.webp
│ ├── TestEXIF.png
│ ├── TestICCProfile.jpg
│ ├── TestImage.bmp
│ ├── TestImage.gif
│ ├── TestImage.heic
│ ├── TestImage.heif
│ ├── TestImage.jpg
│ ├── TestImage.nef
│ ├── TestImage.pdf
│ ├── TestImage.png
│ ├── TestImage.svg
│ ├── TestImageAnimated.apng
│ ├── TestImageAnimated.heics
│ ├── TestImageAnimated.webp
│ ├── TestImageLarge.jpg
│ ├── TestImageLarge.png
│ ├── TestImageStatic.webp
│ ├── TestJFIF.jpg
│ └── TestLoopCount.gif
│ ├── SDAnimatedImageTest.m
│ ├── SDCategoriesTests.m
│ ├── SDImageCacheTests.m
│ ├── SDImageCoderTests.m
│ ├── SDImageTransformerTests.m
│ ├── SDMockFileManager.h
│ ├── SDMockFileManager.m
│ ├── SDTestCase.h
│ ├── SDTestCase.m
│ ├── SDUtilsTests.m
│ ├── SDWebCacheCategoriesTests.m
│ ├── SDWebImageDownloaderTests.m
│ ├── SDWebImageManagerTests.m
│ ├── SDWebImagePrefetcherTests.m
│ ├── SDWebImageTestCache.h
│ ├── SDWebImageTestCache.m
│ ├── SDWebImageTestCoder.h
│ ├── SDWebImageTestCoder.m
│ ├── SDWebImageTestDownloadOperation.h
│ ├── SDWebImageTestDownloadOperation.m
│ ├── SDWebImageTestLoader.h
│ ├── SDWebImageTestLoader.m
│ ├── SDWebImageTestTransformer.h
│ ├── SDWebImageTestTransformer.m
│ ├── Tests-Info.plist
│ └── Tests-Prefix.pch
├── WebImage
├── Info.plist
├── PrivacyInfo.xcprivacy
├── SDWebImage.h
└── SDWebImageMapKit.h
└── codecov.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.mdj binary
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | open_collective: SDWebImage
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### New Issue Checklist
2 |
3 | * [ ] I have read and understood the [CONTRIBUTING guide](https://github.com/rs/SDWebImage/blob/master/.github/CONTRIBUTING.md)
4 | * [ ] I have read the [Documentation](http://cocoadocs.org/docsets/SDWebImage/)
5 | * [ ] I have searched for a similar issue in the [project](https://github.com/rs/SDWebImage/issues) and found none
6 |
7 | ### Issue Info
8 |
9 | Info | Value |
10 | -------------------------|-------------------------------------|
11 | Platform Name | e.g. ios / macos / tvos / watchos
12 | Platform Version | e.g. 12.0 / 10.14.0 / 12.0 / 5.0
13 | SDWebImage Version | e.g. 5.0.0 / 4.4.0
14 | Integration Method | e.g. carthage / cocoapods / manually
15 | Xcode Version | e.g. Xcode 11 / Xcode 10
16 | Repro rate | e.g. all the time (100%) / sometimes x% / only once
17 | Repro with our demo prj | e.g. does it happen with our demo project?
18 | Demo project link | e.g. link to a demo project that highlights the issue
19 |
20 | ### Issue Description and Steps
21 |
22 | Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.
23 |
24 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### New Pull Request Checklist
2 |
3 | * [ ] I have read and understood the [CONTRIBUTING guide](https://github.com/rs/SDWebImage/blob/master/.github/CONTRIBUTING.md)
4 | * [ ] I have read the [Documentation](http://cocoadocs.org/docsets/SDWebImage/)
5 | * [ ] I have searched for a similar pull request in the [project](https://github.com/rs/SDWebImage/pulls) and found none
6 |
7 | * [ ] I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
8 | * [ ] I have added the required tests to prove the fix/feature I am adding
9 | * [ ] I have updated the documentation (if necessary)
10 | * [ ] I have run the tests and they pass
11 | * [ ] I have run the lint and it passes (`pod lib lint`)
12 |
13 | This merge request fixes / refers to the following issues: ...
14 |
15 | ### Pull Request Description
16 |
17 | ...
18 |
19 |
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 60
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 7
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - important
8 | # Label to use when marking an issue as stale
9 | staleLabel: stale
10 | # Comment to post when marking an issue as stale. Set to `false` to disable
11 | markComment: >
12 | This issue has been automatically marked as stale because it has not had
13 | recent activity. It will be closed if no further activity occurs.
14 | If this is still an issue, please make sure it is up to date and if so,
15 | add a comment that this is still an issue to keep it open.
16 | Thank you for your contributions.
17 | # Comment to post when closing a stale issue. Set to `false` to disable
18 | closeComment: false
19 |
20 | # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
21 | pulls:
22 | daysUntilStale: 60
23 | markComment: >
24 | This pull request has been automatically marked as stale because it has not had
25 | recent activity. It will be closed if no further activity occurs.
26 | If this is still applicable, please make sure it is up to date and if so,
27 | add a comment that this is still an issue to keep it open.
28 | Thank you for your contributions.
29 |
--------------------------------------------------------------------------------
/.github/workflows/CD.yml:
--------------------------------------------------------------------------------
1 | name: "SDWebImage CD"
2 |
3 | on:
4 | push:
5 | # Pattern matched against refs/tags
6 | tags:
7 | - '*'
8 |
9 | jobs:
10 | Release:
11 | name: Release XCFramework
12 | runs-on: macos-15
13 | env:
14 | CODESIGN_KEY_BASE64: "${{ secrets.CODESIGN_KEY_BASE64 }}"
15 | DEVELOPER_DIR: /Applications/Xcode_16.0.app
16 | strategy:
17 | fail-fast: true
18 | matrix:
19 | linkage: [dynamic, static]
20 | include:
21 | - linkage: dynamic
22 | MACH_O_TYPE: mh_dylib
23 | - linkage: static
24 | MACH_O_TYPE: staticlib
25 | steps:
26 | - name: Checkout
27 | uses: actions/checkout@v3
28 |
29 | - name: Build XCFramework
30 | run: |
31 | set -o pipefail
32 | export MACH_O_TYPE="${{ matrix.MACH_O_TYPE }}"
33 | ./Scripts/build-frameworks.sh
34 | rm -rf ~/Library/Developer/Xcode/DerivedData/
35 |
36 | - name: Create XCFramework
37 | run: |
38 | set -o pipefail
39 | export MACH_O_TYPE="${{ matrix.MACH_O_TYPE }}"
40 | ./Scripts/create-xcframework.sh
41 | ./Scripts/sign-xcframework.sh
42 |
43 | - name: Archive XCFramework
44 | run: |
45 | cd build
46 | zip -r -y SDWebImage-${{ matrix.linkage }}.xcframework.zip SDWebImage.xcframework
47 | cd ../
48 | mv build/SDWebImage-${{ matrix.linkage }}.xcframework.zip SDWebImage-${{ matrix.linkage }}.xcframework.zip
49 | rm -rf build
50 |
51 | - uses: softprops/action-gh-release@v0.1.15
52 | env:
53 | GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
54 | GITHUB_REPOSITORY: "${{ github.repository }}"
55 | with:
56 | files: "SDWebImage-${{ matrix.linkage }}.xcframework.zip"
57 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 | # Xcode
4 | #
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | project.xcworkspace
15 | !default.xcworkspace
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | *.xcscmblueprint
24 |
25 | # CocoaPods
26 | #
27 | # We recommend against adding the Pods directory to your .gitignore. However
28 | # you should judge for yourself, the pros and cons are mentioned at:
29 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
30 | #
31 | Pods/
32 | Podfile.lock
33 |
34 | # SwiftPM
35 | .build
--------------------------------------------------------------------------------
/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Certificate/SDWebImage Signing Certificate.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Certificate/SDWebImage Signing Certificate.cer
--------------------------------------------------------------------------------
/Certificate/SDWebImage Signing Certificate.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PUBLIC KEY-----
2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtAQgkh+tXn5fT3+pWuyZ
3 | LvIwPoSObko1CbZ8IBOAaPsDQXuinv2BPQ85z2ccjoM4RIJ9MSNK9iMkW3NOQRIy
4 | BVHO8bSi8HQSvm3pt3CEjCwP0o3wd1fGA/P/hHOO5Mu7iJ4isBbsgMXT0pjx0Zjg
5 | HkeR046UyCAm3cYX20lA483NpVH8g7U1LI7YfbMy66KPI0joFnLQ09FGSaVsVdeS
6 | JqaCBCB8IsYjOUPB1vwEvwCxv96APZ58cFwdeSYIzLdTtv3F6pkVpfEKLcV1KE3N
7 | nmHIIiik2UJFUidUnmQJ72HcFIF1tirrZcRr301UCZanI2nei76XtEn//jMW9+2o
8 | ZwIDAQAB
9 | -----END RSA PUBLIC KEY-----
10 |
--------------------------------------------------------------------------------
/Configs/App-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Debug.xcconfig"
5 | #include "App-Shared.xcconfig"
6 |
7 | // If enabled, only the active architecture is built.
8 | ONLY_ACTIVE_ARCH = YES
9 |
--------------------------------------------------------------------------------
/Configs/App-Release.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Release.xcconfig"
5 | #include "App-Shared.xcconfig"
6 |
7 | // If enabled, only the active architecture is built.
8 | ONLY_ACTIVE_ARCH = NO
9 |
10 | // Space-separated list of additional flags to pass to the compiler for C and Objective-C files. Be sure to backslash-escape any arguments that contain spaces or special characters, such as path names that may contain spaces. Use this setting if Xcode does not already provide UI for a particular C or Objective-C compiler flag.
11 | OTHER_CFLAGS = -DNS_BLOCK_ASSERTIONS=1
12 |
--------------------------------------------------------------------------------
/Configs/App-Shared.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Shared.xcconfig"
5 |
6 | // Name of an asset catalog app icon set whose contents will be merged into the `Info.plist`.
7 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
8 |
--------------------------------------------------------------------------------
/Configs/Dynamic.xcconfig:
--------------------------------------------------------------------------------
1 | MACH_O_TYPE = mh_dylib
--------------------------------------------------------------------------------
/Configs/Module-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Shared.xcconfig"
5 |
6 | // Specifies whether binary files that are copied during the build, such as in a Copy Bundle Resources or Copy Files build phase, should be stripped of debugging symbols.
7 | COPY_PHASE_STRIP = NO
8 |
9 | // The type of debug information to produce.
10 | DEBUG_INFORMATION_FORMAT = dwarf
11 |
12 | // Controls whether assertion logic provided by `NSAssert` is included in the preprocessed source code or is elided during preprocessing.
13 | ENABLE_NS_ASSERTIONS = YES
14 |
15 | // When this setting is activated, the product will be built with options appropriate for running automated tests, such as making private interfaces accessible to the tests.
16 | ENABLE_TESTABILITY = YES
17 |
18 | // Specifies the degree to which the generated code is optimized for speed and binary size.
19 | GCC_OPTIMIZATION_LEVEL = 0
20 |
21 | // Space-separated list of preprocessor macros of the form `foo` or `foo=bar`
22 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1
23 |
24 | // Metal debug info - not sure why we need it
25 | MTL_ENABLE_DEBUG_INFO = YES
26 |
27 | // If enabled, only the active architecture is built.
28 | ONLY_ACTIVE_ARCH = YES
29 |
30 | // If enabled, perform validation checks on the product as part of the build process.
31 | VALIDATE_PRODUCT = NO
32 |
--------------------------------------------------------------------------------
/Configs/Module-Release.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Shared.xcconfig"
5 |
6 | // Specifies whether binary files that are copied during the build, such as in a Copy Bundle Resources or Copy Files build phase, should be stripped of debugging symbols.
7 | COPY_PHASE_STRIP = YES
8 |
9 | // The type of debug information to produce.
10 | DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
11 |
12 | // Controls whether assertion logic provided by `NSAssert` is included in the preprocessed source code or is elided during preprocessing.
13 | ENABLE_NS_ASSERTIONS = NO
14 |
15 | // When this setting is activated, the product will be built with options appropriate for running automated tests, such as making private interfaces accessible to the tests.
16 | ENABLE_TESTABILITY = NO
17 |
18 | // Specifies the degree to which the generated code is optimized for speed and binary size.
19 | GCC_OPTIMIZATION_LEVEL = s
20 |
21 | // Metal debug info
22 | MTL_ENABLE_DEBUG_INFO = NO
23 |
24 | // If enabled, only the active architecture is built.
25 | ONLY_ACTIVE_ARCH = NO
26 |
27 | // If enabled, perform validation checks on the product as part of the build process.
28 | VALIDATE_PRODUCT = YES
29 |
--------------------------------------------------------------------------------
/Configs/Static.xcconfig:
--------------------------------------------------------------------------------
1 | MACH_O_TYPE = staticlib
--------------------------------------------------------------------------------
/Configs/Test-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Debug.xcconfig"
5 | #include "Test-Shared.xcconfig"
6 |
7 | // If enabled, only the active architecture is built.
8 | ONLY_ACTIVE_ARCH = YES
9 |
--------------------------------------------------------------------------------
/Configs/Test-Release.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Release.xcconfig"
5 | #include "Test-Shared.xcconfig"
6 |
7 | // If enabled, only the active architecture is built.
8 | ONLY_ACTIVE_ARCH = NO
9 |
10 | // Space-separated list of additional flags to pass to the compiler for C and Objective-C files. Be sure to backslash-escape any arguments that contain spaces or special characters, such as path names that may contain spaces. Use this setting if Xcode does not already provide UI for a particular C or Objective-C compiler flag.
11 | OTHER_CFLAGS = -DNS_BLOCK_ASSERTIONS=1
12 |
--------------------------------------------------------------------------------
/Configs/Test-Shared.xcconfig:
--------------------------------------------------------------------------------
1 | // Configuration settings file format documentation can be found at:
2 | // https://help.apple.com/xcode/#/dev745c5c974
3 |
4 | #include "Module-Shared.xcconfig"
5 |
6 | // This is a list of paths to folders to be searched by the compiler for included or imported header files when compiling C, Objective-C, C++, or Objective-C++. Paths are delimited by whitespace, so any paths with spaces in them need to be properly quoted.
7 | HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/../SDWebImage/Private"
8 |
9 | // Warns when a quoted include is used instead of a framework style include in a framework header.
10 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
11 |
12 | // If enabled, the build system will sandbox user scripts to disallow undeclared input/output dependencies.
13 | ENABLE_USER_SCRIPT_SANDBOXING = NO
14 |
--------------------------------------------------------------------------------
/Docs/API-Diff/5.0/apidiff.css:
--------------------------------------------------------------------------------
1 | body {
2 | font: 12px 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;
3 | margin: 0;
4 | padding: 0 2em 2em 2em;
5 | }
6 |
7 | h1 {
8 | margin-top: 30px;
9 | margin-bottom: 30px;
10 | font-size: 28px;
11 | font-weight: bold;
12 | }
13 |
14 | .headerFile {
15 | margin-left: 20px;
16 | }
17 |
18 | .headerName {
19 | margin: 15px 0px 10px -20px;
20 | padding: 4px 4px 4px 20px;
21 | font-weight: bold;
22 | font-size: 120%;
23 | background-color: #f8f8f8;
24 | }
25 |
26 | .differenceGroup {
27 | margin-top: 5px;
28 | }
29 |
30 | .difference {
31 | padding-left: 20px;
32 | font-family: Courier, Consolas, monospace;
33 | font-size: 110%;
34 | }
35 |
36 | .status {
37 | font-style: italic;
38 | font-size: 80%;
39 | }
40 |
41 | .removed {
42 | color: red;
43 | }
44 |
45 | .added {
46 | color: blue;
47 | }
48 |
49 | .modified {
50 | color: #080;
51 | }
52 |
53 | .declaration {
54 | font-family: Courier, Consolas, monospace;
55 | }
56 |
57 | table {
58 | border: 1px #888 solid;
59 | padding: 2px;
60 | border-spacing: 0px;
61 | border-collapse: collapse;
62 | margin-left: 40px;
63 | margin-top: 7px;
64 | }
65 |
66 | td, th {
67 | font-size: 10px;
68 | border: 1px #888 solid;
69 | padding:3px 6px;
70 | }
71 |
72 | th {
73 | font-size: 10px;
74 | text-align: center;
75 | background-color: #eee;
76 | }
77 |
78 | td {
79 | font-size: 90%;
80 | text-align: left;
81 | }
82 |
83 | ul {
84 | list-style: disc outside;
85 | margin: 0 0 0 16px;
86 | padding: 0;
87 | }
88 |
89 | li {
90 | margin-top: 7px;
91 | }
92 |
93 | .message {
94 | margin-left: 20px;
95 | font-style: italic;
96 | color: #888;
97 | }
98 |
99 | a:link { color: #18396E; text-decoration: none; }
100 | a:active { color: #18396E; text-decoration: none; }
101 | a:visited { color: #003366; text-decoration: none; }
102 | a:link:hover { color: #18396E; text-decoration: underline; }
103 | a:visited:hover { color: #003366; text-decoration: underline; }
104 |
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageCacheClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageCacheClassDiagram.png
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageClassDiagram.png
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageCodersClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageCodersClassDiagram.png
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageHighLevelDiagram.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageHighLevelDiagram.jpeg
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageLoaderClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageLoaderClassDiagram.png
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageManagerClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageManagerClassDiagram.png
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageSequenceDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageSequenceDiagram.png
--------------------------------------------------------------------------------
/Docs/Diagrams/SDWebImageTopLevelClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Docs/Diagrams/SDWebImageTopLevelClassDiagram.png
--------------------------------------------------------------------------------
/Examples/CustomPathImages/4ad9ae8eabfec60b40bf48f0bfc2d120:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Examples/CustomPathImages/4ad9ae8eabfec60b40bf48f0bfc2d120
--------------------------------------------------------------------------------
/Examples/Packages/RealityKitContent/Package.realitycomposerpro/ProjectData/main.json:
--------------------------------------------------------------------------------
1 | {
2 | "pathsToIds" : {
3 | "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/GridMaterial.usda" : "440DE5B4-E4E4-459B-AABF-9ACE96319272",
4 | "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/procedural_sphere_grid.usda" : "34C460AE-CA1B-4348-BD05-621ACBDFFE97",
5 | "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/Scene.usda" : "0A9B4653-B11E-4D6A-850E-C6FCB621626C",
6 | "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/Untitled Scene.usda" : "03E02005-EFA6-48D6-8A76-05B2822A74E9",
7 | "RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/GridMaterial.usda" : "FBD8436F-6B8B-4B82-99B5-995D538B4704",
8 | "RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/procedural_sphere_grid.usda" : "1CBF3893-ABFD-408C-8B91-045BFD257808",
9 | "RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/Scene.usda" : "26DBAE76-5DD8-47B6-A085-1B4ADA111097"
10 | }
11 | }
--------------------------------------------------------------------------------
/Examples/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/Settings.rcprojectdata:
--------------------------------------------------------------------------------
1 | {
2 | "cameraPresets" : {
3 |
4 | },
5 | "secondaryToolbarData" : {
6 | "isGridVisible" : true,
7 | "sceneReverbPreset" : -1
8 | },
9 | "unitDefaults" : {
10 | "°" : "°",
11 | "kg" : "g",
12 | "m" : "cm",
13 | "m\/s" : "m\/s",
14 | "m\/s²" : "m\/s²",
15 | "s" : "s"
16 | }
17 | }
--------------------------------------------------------------------------------
/Examples/Packages/RealityKitContent/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.9
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "RealityKitContent",
8 | products: [
9 | // Products define the executables and libraries a package produces, and make them visible to other packages.
10 | .library(
11 | name: "RealityKitContent",
12 | targets: ["RealityKitContent"]),
13 | ],
14 | dependencies: [
15 | // Dependencies declare other packages that this package depends on.
16 | // .package(url: /* package url */, from: "1.0.0"),
17 | ],
18 | targets: [
19 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
20 | // Targets can depend on other targets in this package, and on products in packages this package depends on.
21 | .target(
22 | name: "RealityKitContent",
23 | dependencies: []),
24 | ]
25 | )
--------------------------------------------------------------------------------
/Examples/Packages/RealityKitContent/README.md:
--------------------------------------------------------------------------------
1 | # RealityKitContent
2 |
3 | A description of this package.
--------------------------------------------------------------------------------
/Examples/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Scene.usda:
--------------------------------------------------------------------------------
1 | #usda 1.0
2 | (
3 | defaultPrim = "Root"
4 | metersPerUnit = 1
5 | upAxis = "Y"
6 | )
7 |
8 | def Xform "Root"
9 | {
10 | reorder nameChildren = ["GridMaterial", "Sphere"]
11 | rel material:binding = None (
12 | bindMaterialAs = "weakerThanDescendants"
13 | )
14 |
15 | def Sphere "Sphere" (
16 | active = true
17 | prepend apiSchemas = ["MaterialBindingAPI"]
18 | )
19 | {
20 | rel material:binding = (
21 | bindMaterialAs = "weakerThanDescendants"
22 | )
23 | double radius = 0.05
24 | quatf xformOp:orient = (1, 0, 0, 0)
25 | float3 xformOp:scale = (1, 1, 1)
26 | float3 xformOp:translate = (0, 0, 0.0004)
27 | uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
28 |
29 | def RealityKitComponent "Collider"
30 | {
31 | uint group = 1
32 | uniform token info:id = "RealityKit.Collider"
33 | uint mask = 4294967295
34 | token type = "Default"
35 |
36 | def RealityKitStruct "Shape"
37 | {
38 | float3 extent = (0.2, 0.2, 0.2)
39 | float radius = 0.05
40 | token shapeType = "Sphere"
41 | }
42 | }
43 |
44 | def RealityKitComponent "InputTarget"
45 | {
46 | uniform token info:id = "RealityKit.InputTarget"
47 | }
48 | }
49 |
50 | def "GridMaterial" (
51 | active = true
52 | prepend references = @Materials/GridMaterial.usda@
53 | )
54 | {
55 | float3 xformOp:scale = (1, 1, 1)
56 | uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/Examples/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /// Bundle for the RealityKitContent project
4 | public let realityKitContentBundle = Bundle.module
5 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/AppDelegate.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 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @property (strong, nonatomic) UINavigationController *navigationController;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "placeholder.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "placeholder@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder.png
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder@2x.png
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/DetailViewController.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 | @interface DetailViewController : UIViewController
12 |
13 | @property (strong, nonatomic) NSURL *imageURL;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundleIcons~ipad
14 |
15 | CFBundleIdentifier
16 | $(PRODUCT_BUNDLE_IDENTIFIER)
17 | CFBundleInfoDictionaryVersion
18 | 6.0
19 | CFBundleName
20 | ${PRODUCT_NAME}
21 | CFBundlePackageType
22 | APPL
23 | CFBundleShortVersionString
24 | 1.0
25 | CFBundleSignature
26 | ????
27 | CFBundleVersion
28 | 1
29 | LSRequiresIPhoneOS
30 |
31 | NSAppTransportSecurity
32 |
33 | NSAllowsArbitraryLoads
34 |
35 |
36 | UILaunchStoryboardName
37 | LaunchScreen
38 | UIRequiredDeviceCapabilities
39 |
40 | armv7
41 |
42 | UISupportedInterfaceOrientations
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationLandscapeLeft
46 | UIInterfaceOrientationLandscapeRight
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/MasterViewController.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 | @interface MasterViewController : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/en.lproj/DetailViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/en.lproj/MasterViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Demo/main.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
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/AppDelegate.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 | @interface AppDelegate : NSObject
12 |
13 | @property (strong, nonatomic) NSWindowController *windowController;
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/AppDelegate.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 "AppDelegate.h"
10 |
11 | #import
12 | #import
13 |
14 | @interface AppDelegate ()
15 |
16 | @end
17 |
18 | @implementation AppDelegate
19 |
20 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
21 | // Insert code here to initialize your application
22 | if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) {
23 | // iOS 14 supports WebP built-in
24 | [[SDImageCodersManager sharedManager] addCoder:[SDImageAWebPCoder sharedCoder]];
25 | } else {
26 | // iOS 13 does not supports WebP, use third-party codec
27 | [[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
28 | }
29 | if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {
30 | // For HEIC animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
31 | [[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]];
32 | }
33 |
34 | NSStoryboard *mainStoryboard = [NSStoryboard storyboardWithName:@"Main" bundle:nil];
35 | NSWindowController *initialController = [mainStoryboard instantiateControllerWithIdentifier:@"MainWindowController"];
36 | self.windowController = initialController;
37 | [initialController showWindow:self];
38 | [initialController.window makeKeyAndOrderFront:self];
39 | }
40 |
41 | - (void)applicationWillTerminate:(NSNotification *)aNotification {
42 | // Insert code here to tear down your application
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSAppTransportSecurity
6 |
7 | NSAllowsArbitraryLoads
8 |
9 |
10 | CFBundleDevelopmentRegion
11 | en
12 | CFBundleExecutable
13 | $(EXECUTABLE_NAME)
14 | CFBundleIconFile
15 |
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 | LSMinimumSystemVersion
31 | $(MACOSX_DEPLOYMENT_TARGET)
32 | NSHumanReadableCopyright
33 | Copyright © 2017 Dailymotion. All rights reserved.
34 | NSMainStoryboardFile
35 | Main
36 | NSPrincipalClass
37 | NSApplication
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/ViewController.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 | @interface ViewController : NSViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/WindowController.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 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface WindowController : NSWindowController
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/WindowController.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 "WindowController.h"
10 |
11 | @implementation WindowController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Examples/SDWebImage OSX Demo/main.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
10 |
11 | int main(int argc, const char * argv[]) {
12 | return NSApplicationMain(argc, argv);
13 | }
14 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/AppDelegate.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 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "layers" : [
3 | {
4 | "filename" : "Front.imagestacklayer"
5 | },
6 | {
7 | "filename" : "Middle.imagestacklayer"
8 | },
9 | {
10 | "filename" : "Back.imagestacklayer"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "layers" : [
3 | {
4 | "filename" : "Front.imagestacklayer"
5 | },
6 | {
7 | "filename" : "Middle.imagestacklayer"
8 | },
9 | {
10 | "filename" : "Back.imagestacklayer"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "assets" : [
3 | {
4 | "size" : "1280x768",
5 | "idiom" : "tv",
6 | "filename" : "App Icon - Large.imagestack",
7 | "role" : "primary-app-icon"
8 | },
9 | {
10 | "size" : "400x240",
11 | "idiom" : "tv",
12 | "filename" : "App Icon - Small.imagestack",
13 | "role" : "primary-app-icon"
14 | },
15 | {
16 | "size" : "2320x720",
17 | "idiom" : "tv",
18 | "filename" : "Top Shelf Image Wide.imageset",
19 | "role" : "top-shelf-image-wide"
20 | },
21 | {
22 | "size" : "1920x720",
23 | "idiom" : "tv",
24 | "filename" : "Top Shelf Image.imageset",
25 | "role" : "top-shelf-image"
26 | }
27 | ],
28 | "info" : {
29 | "version" : 1,
30 | "author" : "xcode"
31 | }
32 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "tv",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "tv",
9 | "scale" : "2x"
10 | }
11 | ],
12 | "info" : {
13 | "version" : 1,
14 | "author" : "xcode"
15 | }
16 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "landscape",
5 | "idiom" : "tv",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "11.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "landscape",
12 | "idiom" : "tv",
13 | "extent" : "full-screen",
14 | "minimum-system-version" : "9.0",
15 | "scale" : "1x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSAppTransportSecurity
6 |
7 | NSAllowsArbitraryLoads
8 |
9 |
10 | CFBundleDevelopmentRegion
11 | en
12 | CFBundleExecutable
13 | $(EXECUTABLE_NAME)
14 | CFBundleIdentifier
15 | $(PRODUCT_BUNDLE_IDENTIFIER)
16 | CFBundleInfoDictionaryVersion
17 | 6.0
18 | CFBundleName
19 | $(PRODUCT_NAME)
20 | CFBundlePackageType
21 | APPL
22 | CFBundleShortVersionString
23 | 1.0
24 | CFBundleSignature
25 | ????
26 | CFBundleVersion
27 | 1
28 | LSRequiresIPhoneOS
29 |
30 | UIMainStoryboardFile
31 | Main
32 | UIRequiredDeviceCapabilities
33 |
34 | arm64
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/ViewController.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 | @interface ViewController : UIViewController
12 |
13 | @end
14 |
15 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/ViewController.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 "ViewController.h"
10 | #import
11 |
12 | @interface ViewController ()
13 |
14 | @property (weak, nonatomic) IBOutlet UIImageView *imageView1;
15 | @property (weak, nonatomic) IBOutlet UIImageView *imageView2;
16 | @property (weak, nonatomic) IBOutlet SDAnimatedImageView *imageView3;
17 | @property (weak, nonatomic) IBOutlet SDAnimatedImageView *imageView4;
18 |
19 | @end
20 |
21 |
22 | @implementation ViewController
23 |
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | // Do any additional setup after loading the view, typically from a nib.
27 |
28 | [self.imageView1 sd_setImageWithURL:[NSURL URLWithString:@"https://nokiatech.github.io/heif/content/images/ski_jump_1440x960.heic"]];
29 | [self.imageView2 sd_setImageWithURL:[NSURL URLWithString:@"http://www.ioncannon.net/wp-content/uploads/2011/06/test2.webp"]];
30 | [self.imageView3 sd_setImageWithURL:[NSURL URLWithString:@"https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"]];
31 | [self.imageView4 sd_setImageWithURL:[NSURL URLWithString:@"http://littlesvr.ca/apng/images/SteamEngine.webp"]];
32 | }
33 |
34 | - (void)didReceiveMemoryWarning {
35 | [super didReceiveMemoryWarning];
36 | // Dispose of any resources that can be recreated.
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Examples/SDWebImage TV Demo/main.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
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/App.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) DreamPiggy
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 SwiftUI
10 | import SDWebImage
11 |
12 | class AppDelegate: NSObject, UIApplicationDelegate {
13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
14 | // Insert code here to initialize your application
15 | SDImageCodersManager.shared.addCoder(SDImageAWebPCoder.shared)
16 | SDImageCodersManager.shared.addCoder(SDImageHEICCoder.shared)
17 | return true
18 | }
19 | }
20 |
21 | @main
22 | struct SDWebImage_Vision_DemoApp: App {
23 | @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
24 |
25 | var body: some Scene {
26 | WindowGroup {
27 | ContentView()
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "vision",
5 | "scale" : "2x"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | },
6 | "layers" : [
7 | {
8 | "filename" : "Front.solidimagestacklayer"
9 | },
10 | {
11 | "filename" : "Middle.solidimagestacklayer"
12 | },
13 | {
14 | "filename" : "Back.solidimagestacklayer"
15 | }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "vision",
5 | "scale" : "2x"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "vision",
5 | "scale" : "2x"
6 | }
7 | ],
8 | "info" : {
9 | "author" : "xcode",
10 | "version" : 1
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/DetailView.swift:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) DreamPiggy
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 SwiftUI
10 | import SDWebImageSwiftUI
11 |
12 | struct DetailView: View {
13 | let url: String
14 | @State var animated: Bool = true // You can change between WebImage/AnimatedImage
15 | @State var isAnimating: Bool = true
16 |
17 | var body: some View {
18 | VStack {
19 | contentView()
20 | .navigationBarItems(trailing: Button(isAnimating ? "Stop" : "Start") {
21 | self.isAnimating.toggle()
22 | })
23 | }
24 | }
25 | func contentView() -> some View {
26 | HStack {
27 | if animated {
28 | AnimatedImage(url: URL(string:url), options: [.progressiveLoad, .delayPlaceholder], isAnimating: $isAnimating)
29 | .indicator(.progress)
30 | .resizable()
31 | .scaledToFit()
32 | } else {
33 | WebImage(url: URL(string:url), options: [.progressiveLoad, .delayPlaceholder], isAnimating: $isAnimating)
34 | .resizable()
35 | .indicator(.progress)
36 | .scaledToFit()
37 | }
38 | }
39 | }
40 | }
41 |
42 | #if DEBUG
43 | struct DetailView_Previews: PreviewProvider {
44 | static var previews: some View {
45 | DetailView(url: "https://nokiatech.github.io/heif/content/images/ski_jump_1440x960.heic", animated: false)
46 | }
47 | }
48 | #endif
49 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSAppTransportSecurity
6 |
7 | NSAllowsArbitraryLoads
8 |
9 |
10 | UIApplicationSceneManifest
11 |
12 | UIApplicationPreferredDefaultSceneSessionRole
13 | UIWindowSceneSessionRoleApplication
14 | UIApplicationSupportsMultipleScenes
15 |
16 | UISceneConfigurations
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Vision Demo/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/Assets.xcassets/README__ignoredByTemplate__:
--------------------------------------------------------------------------------
1 | Did you know that git does not support storing empty directories?
2 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/ExtensionDelegate.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 | @interface ExtensionDelegate : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/ExtensionDelegate.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 "ExtensionDelegate.h"
10 |
11 | #import
12 | #import
13 |
14 | @implementation ExtensionDelegate
15 |
16 | - (void)applicationDidFinishLaunching {
17 | // Perform any final initialization of your application.
18 | if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) {
19 | // iOS 14 supports WebP built-in
20 | [[SDImageCodersManager sharedManager] addCoder:[SDImageAWebPCoder sharedCoder]];
21 | } else {
22 | // iOS 13 does not supports WebP, use third-party codec
23 | [[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
24 | }
25 | if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {
26 | // For HEIC animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
27 | [[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]];
28 | }
29 | }
30 |
31 | - (void)applicationDidBecomeActive {
32 | // 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.
33 | }
34 |
35 | - (void)applicationWillResignActive {
36 | // 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.
37 | // Use this method to pause ongoing tasks, disable timers, etc.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSAppTransportSecurity
6 |
7 | NSAllowsArbitraryLoads
8 |
9 |
10 | CFBundleDevelopmentRegion
11 | en
12 | CFBundleDisplayName
13 | SDWebImage Watch Demo Extension
14 | CFBundleExecutable
15 | $(EXECUTABLE_NAME)
16 | CFBundleIdentifier
17 | $(PRODUCT_BUNDLE_IDENTIFIER)
18 | CFBundleInfoDictionaryVersion
19 | 6.0
20 | CFBundleName
21 | $(PRODUCT_NAME)
22 | CFBundlePackageType
23 | XPC!
24 | CFBundleShortVersionString
25 | 1.0
26 | CFBundleSignature
27 | ????
28 | CFBundleVersion
29 | 1
30 | NSExtension
31 |
32 | NSExtensionAttributes
33 |
34 | WKAppBundleIdentifier
35 | com.dailymotion.SDWebImage-iOS-Demo.watchkitapp
36 |
37 | NSExtensionPointIdentifier
38 | com.apple.watchkit
39 |
40 | WKExtensionDelegateClassName
41 | ExtensionDelegate
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/InterfaceController.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
11 |
12 | @interface InterfaceController : WKInterfaceController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/NotificationController.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
11 |
12 | @interface NotificationController : WKUserNotificationInterfaceController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/NotificationController.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 "NotificationController.h"
10 |
11 |
12 | @interface NotificationController()
13 |
14 | @end
15 |
16 |
17 | @implementation NotificationController
18 |
19 | - (instancetype)init {
20 | self = [super init];
21 | if (self){
22 | // Initialize variables here.
23 | // Configure interface objects here.
24 |
25 | }
26 | return self;
27 | }
28 |
29 | - (void)willActivate {
30 | // This method is called when watch view controller is about to be visible to user
31 | [super willActivate];
32 | }
33 |
34 | - (void)didDeactivate {
35 | // This method is called when watch view controller is no longer visible
36 | [super didDeactivate];
37 | }
38 |
39 | @end
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo Extension/PushNotificationPayload.apns:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": {
4 | "body": "Test message",
5 | "title": "Optional title"
6 | },
7 | "category": "myCategory"
8 | },
9 |
10 | "WatchKit Simulator Actions": [
11 | {
12 | "title": "First Button",
13 | "identifier": "firstButtonAction"
14 | }
15 | ],
16 |
17 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
18 | }
19 |
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "24x24",
5 | "idiom" : "watch",
6 | "scale" : "2x",
7 | "role" : "notificationCenter",
8 | "subtype" : "38mm"
9 | },
10 | {
11 | "size" : "27.5x27.5",
12 | "idiom" : "watch",
13 | "scale" : "2x",
14 | "role" : "notificationCenter",
15 | "subtype" : "42mm"
16 | },
17 | {
18 | "size" : "29x29",
19 | "idiom" : "watch",
20 | "role" : "companionSettings",
21 | "scale" : "2x"
22 | },
23 | {
24 | "size" : "29x29",
25 | "idiom" : "watch",
26 | "role" : "companionSettings",
27 | "scale" : "3x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "watch",
32 | "scale" : "2x",
33 | "role" : "appLauncher",
34 | "subtype" : "38mm"
35 | },
36 | {
37 | "size" : "44x44",
38 | "idiom" : "watch",
39 | "scale" : "2x",
40 | "role" : "appLauncher",
41 | "subtype" : "40mm"
42 | },
43 | {
44 | "size" : "50x50",
45 | "idiom" : "watch",
46 | "scale" : "2x",
47 | "role" : "appLauncher",
48 | "subtype" : "44mm"
49 | },
50 | {
51 | "size" : "86x86",
52 | "idiom" : "watch",
53 | "scale" : "2x",
54 | "role" : "quickLook",
55 | "subtype" : "38mm"
56 | },
57 | {
58 | "size" : "98x98",
59 | "idiom" : "watch",
60 | "scale" : "2x",
61 | "role" : "quickLook",
62 | "subtype" : "42mm"
63 | },
64 | {
65 | "size" : "108x108",
66 | "idiom" : "watch",
67 | "scale" : "2x",
68 | "role" : "quickLook",
69 | "subtype" : "44mm"
70 | },
71 | {
72 | "idiom" : "watch-marketing",
73 | "size" : "1024x1024",
74 | "scale" : "1x"
75 | }
76 | ],
77 | "info" : {
78 | "version" : 1,
79 | "author" : "xcode"
80 | }
81 | }
--------------------------------------------------------------------------------
/Examples/SDWebImage Watch Demo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | SDWebImage iOS Demo
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | UISupportedInterfaceOrientations
26 |
27 | UIInterfaceOrientationPortrait
28 | UIInterfaceOrientationPortraitUpsideDown
29 |
30 | WKCompanionAppBundleIdentifier
31 | com.dailymotion.SDWebImage-iOS-Demo
32 | WKWatchKitApp
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009-2020 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 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.3
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "SDWebImage",
8 | platforms: [
9 | .macOS(.v10_11),
10 | .iOS(.v9),
11 | .tvOS(.v9),
12 | .watchOS(.v2)
13 | ],
14 | products: [
15 | // Products define the executables and libraries produced by a package, and make them visible to other packages.
16 | .library(
17 | name: "SDWebImage",
18 | targets: ["SDWebImage"]),
19 | .library(
20 | name: "SDWebImageMapKit",
21 | targets: ["SDWebImageMapKit"])
22 | ],
23 | dependencies: [
24 | // Dependencies declare other packages that this package depends on.
25 | // .package(url: /* package url */, from: "1.0.0"),
26 | ],
27 | targets: [
28 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
29 | // Targets can depend on other targets in this package, and on products in packages which this package depends on.
30 | .target(
31 | name: "SDWebImage",
32 | dependencies: [],
33 | path: "SDWebImage",
34 | sources: ["Core", "Private"],
35 | resources: [.copy("Resources/PrivacyInfo.xcprivacy")],
36 | cSettings: [
37 | .headerSearchPath("Core"),
38 | .headerSearchPath("Private")
39 | ]
40 | ),
41 | .target(
42 | name: "SDWebImageMapKit",
43 | dependencies: ["SDWebImage"],
44 | path: "SDWebImageMapKit",
45 | sources: ["MapKit"],
46 | resources: [.copy("Resources/PrivacyInfo.xcprivacy")]
47 | )
48 | ]
49 | )
50 |
--------------------------------------------------------------------------------
/SDWebImage.json:
--------------------------------------------------------------------------------
1 | {
2 | "5.19.2": "https://github.com/SDWebImage/SDWebImage/releases/download/5.19.2/SDWebImage-dynamic.xcframework.zip",
3 | "5.19.3": "https://github.com/SDWebImage/SDWebImage/releases/download/5.19.3/SDWebImage-dynamic.xcframework.zip",
4 | "5.19.4": "https://github.com/SDWebImage/SDWebImage/releases/download/5.19.4/SDWebImage-dynamic.xcframework.zip",
5 | "5.19.5": "https://github.com/SDWebImage/SDWebImage/releases/download/5.19.5/SDWebImage-dynamic.xcframework.zip",
6 | "5.19.6": "https://github.com/SDWebImage/SDWebImage/releases/download/5.19.6/SDWebImage-dynamic.xcframework.zip",
7 | "5.19.7": "https://github.com/SDWebImage/SDWebImage/releases/download/5.19.7/SDWebImage-dynamic.xcframework.zip",
8 | "5.20.0": "https://github.com/SDWebImage/SDWebImage/releases/download/5.20.0/SDWebImage-dynamic.xcframework.zip"
9 | }
10 |
--------------------------------------------------------------------------------
/SDWebImage.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'SDWebImage'
3 | s.version = '5.20.0'
4 |
5 | s.osx.deployment_target = '10.11'
6 | s.ios.deployment_target = '9.0'
7 | s.tvos.deployment_target = '9.0'
8 | s.watchos.deployment_target = '2.0'
9 | s.visionos.deployment_target = "1.0"
10 |
11 | s.license = 'MIT'
12 | s.summary = 'Asynchronous image downloader with cache support with an UIImageView category.'
13 | s.homepage = 'https://github.com/SDWebImage/SDWebImage'
14 | s.author = { 'Olivier Poitrey' => 'rs@dailymotion.com' }
15 | s.source = { :git => 'https://github.com/SDWebImage/SDWebImage.git', :tag => s.version.to_s }
16 |
17 | s.description = 'This library provides a category for UIImageView with support for remote ' \
18 | 'images coming from the web. It provides an UIImageView category adding web ' \
19 | 'image and cache management to the Cocoa Touch framework, an asynchronous ' \
20 | 'image downloader, an asynchronous memory + disk image caching with automatic ' \
21 | 'cache expiration handling, a guarantee that the same URL won\'t be downloaded ' \
22 | 'several times, a guarantee that bogus URLs won\'t be retried again and again, ' \
23 | 'and performances!'
24 |
25 | s.requires_arc = true
26 | s.framework = 'ImageIO'
27 |
28 | s.default_subspec = 'Core'
29 |
30 | s.pod_target_xcconfig = {
31 | 'SUPPORTS_MACCATALYST' => 'YES',
32 | 'DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER' => 'NO'
33 | }
34 |
35 | s.subspec 'Core' do |core|
36 | core.source_files = 'SDWebImage/Core/*.{h,m}', 'WebImage/SDWebImage.h', 'SDWebImage/Private/*.{h,m}'
37 | core.private_header_files = 'SDWebImage/Private/*.h'
38 | core.resource_bundles = {'SDWebImage' => ['WebImage/PrivacyInfo.xcprivacy']}
39 | end
40 |
41 | s.subspec 'MapKit' do |mk|
42 | mk.osx.deployment_target = '10.11'
43 | mk.ios.deployment_target = '9.0'
44 | mk.tvos.deployment_target = '9.0'
45 | mk.visionos.deployment_target = "1.0"
46 | mk.source_files = 'SDWebImageMapKit/MapKit/*.{h,m}'
47 | mk.framework = 'MapKit'
48 | mk.dependency 'SDWebImage/Core'
49 | end
50 | end
51 |
--------------------------------------------------------------------------------
/SDWebImage.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
15 |
16 |
18 |
19 |
21 |
22 |
24 |
25 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/SDWebImage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SDWebImage/Core/NSData+ImageContentType.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Fabrice Aneche
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import
11 | #import "SDWebImageCompat.h"
12 |
13 | /**
14 | You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value.
15 | For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information.
16 | */
17 | typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM;
18 | static const SDImageFormat SDImageFormatUndefined = -1;
19 | static const SDImageFormat SDImageFormatJPEG = 0;
20 | static const SDImageFormat SDImageFormatPNG = 1;
21 | static const SDImageFormat SDImageFormatGIF = 2;
22 | static const SDImageFormat SDImageFormatTIFF = 3;
23 | static const SDImageFormat SDImageFormatWebP = 4;
24 | static const SDImageFormat SDImageFormatHEIC = 5;
25 | static const SDImageFormat SDImageFormatHEIF = 6;
26 | static const SDImageFormat SDImageFormatPDF = 7;
27 | static const SDImageFormat SDImageFormatSVG = 8;
28 | static const SDImageFormat SDImageFormatBMP = 9;
29 | static const SDImageFormat SDImageFormatRAW = 10;
30 |
31 | /**
32 | NSData category about the image content type and UTI.
33 | */
34 | @interface NSData (ImageContentType)
35 |
36 | /**
37 | * Return image format
38 | *
39 | * @param data the input image data
40 | *
41 | * @return the image format as `SDImageFormat` (enum)
42 | */
43 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;
44 |
45 | /**
46 | * Convert SDImageFormat to UTType
47 | *
48 | * @param format Format as SDImageFormat
49 | * @return The UTType as CFStringRef
50 | * @note For unknown format, `kSDUTTypeImage` abstract type will return
51 | */
52 | + (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:));
53 |
54 | /**
55 | * Convert UTType to SDImageFormat
56 | *
57 | * @param uttype The UTType as CFStringRef
58 | * @return The Format as SDImageFormat
59 | * @note For unknown type, `SDImageFormatUndefined` will return
60 | */
61 | + (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype;
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/SDWebImage/Core/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 | #import "NSData+ImageContentType.h"
14 |
15 | /**
16 | A subclass of `NSBitmapImageRep` to fix that GIF duration issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`.
17 | This also fix the GIF loop count issue, which will use the Netscape standard (See http://www6.uniovi.es/gifanim/gifabout.htm) to only place once when the `kCGImagePropertyGIFLoopCount` is nil. This is what modern browser's behavior.
18 | Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image.
19 | This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`.
20 | */
21 | @interface SDAnimatedImageRep : NSBitmapImageRep
22 |
23 | /// Current animated image format.
24 | /// @note This format is only valid when `animatedImageData` not nil
25 | @property (nonatomic, assign, readonly) SDImageFormat animatedImageFormat;
26 |
27 | /// This allows to retrive the compressed data like GIF using `sd_imageData` on parent `NSImage`, without re-encoding (waste CPU and RAM)
28 | /// @note This is typically nonnull when you create with `initWithData:`, even it's marked as weak, because ImageIO retain it
29 | @property (nonatomic, readonly, nullable, weak) NSData *animatedImageData;
30 |
31 | @end
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageAPNGCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDImageIOAnimatedCoder.h"
11 |
12 | /**
13 | Built in coder using ImageIO that supports APNG encoding/decoding
14 | */
15 | @interface SDImageAPNGCoder : SDImageIOAnimatedCoder
16 |
17 | @property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageAPNGCoder.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 "SDImageAPNGCoder.h"
10 | #import "SDImageIOAnimatedCoderInternal.h"
11 | #if SD_MAC
12 | #import
13 | #else
14 | #import
15 | #endif
16 |
17 | @implementation SDImageAPNGCoder
18 |
19 | + (instancetype)sharedCoder {
20 | static SDImageAPNGCoder *coder;
21 | static dispatch_once_t onceToken;
22 | dispatch_once(&onceToken, ^{
23 | coder = [[SDImageAPNGCoder alloc] init];
24 | });
25 | return coder;
26 | }
27 |
28 | #pragma mark - Subclass Override
29 |
30 | + (SDImageFormat)imageFormat {
31 | return SDImageFormatPNG;
32 | }
33 |
34 | + (NSString *)imageUTType {
35 | return (__bridge NSString *)kSDUTTypePNG;
36 | }
37 |
38 | + (NSString *)dictionaryProperty {
39 | return (__bridge NSString *)kCGImagePropertyPNGDictionary;
40 | }
41 |
42 | + (NSString *)unclampedDelayTimeProperty {
43 | return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime;
44 | }
45 |
46 | + (NSString *)delayTimeProperty {
47 | return (__bridge NSString *)kCGImagePropertyAPNGDelayTime;
48 | }
49 |
50 | + (NSString *)loopCountProperty {
51 | return (__bridge NSString *)kCGImagePropertyAPNGLoopCount;
52 | }
53 |
54 | + (NSUInteger)defaultLoopCount {
55 | return 0;
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageAWebPCoder.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 "SDImageIOAnimatedCoder.h"
11 |
12 | /**
13 | This coder is used for Google WebP and Animated WebP(AWebP) image format.
14 | Image/IO provide the WebP decoding support in iOS 14/macOS 11/tvOS 14/watchOS 7+.
15 | @note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below.
16 | @note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder
17 | */
18 | API_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0))
19 | @interface SDImageAWebPCoder : SDImageIOAnimatedCoder
20 |
21 | @property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageCoder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDImageCoder.h"
10 |
11 | SDImageCoderOption const SDImageCoderDecodeFirstFrameOnly = @"decodeFirstFrameOnly";
12 | SDImageCoderOption const SDImageCoderDecodeScaleFactor = @"decodeScaleFactor";
13 | SDImageCoderOption const SDImageCoderDecodePreserveAspectRatio = @"decodePreserveAspectRatio";
14 | SDImageCoderOption const SDImageCoderDecodeThumbnailPixelSize = @"decodeThumbnailPixelSize";
15 | SDImageCoderOption const SDImageCoderDecodeFileExtensionHint = @"decodeFileExtensionHint";
16 | SDImageCoderOption const SDImageCoderDecodeTypeIdentifierHint = @"decodeTypeIdentifierHint";
17 | SDImageCoderOption const SDImageCoderDecodeUseLazyDecoding = @"decodeUseLazyDecoding";
18 | SDImageCoderOption const SDImageCoderDecodeScaleDownLimitBytes = @"decodeScaleDownLimitBytes";
19 |
20 | SDImageCoderOption const SDImageCoderEncodeFirstFrameOnly = @"encodeFirstFrameOnly";
21 | SDImageCoderOption const SDImageCoderEncodeCompressionQuality = @"encodeCompressionQuality";
22 | SDImageCoderOption const SDImageCoderEncodeBackgroundColor = @"encodeBackgroundColor";
23 | SDImageCoderOption const SDImageCoderEncodeMaxPixelSize = @"encodeMaxPixelSize";
24 | SDImageCoderOption const SDImageCoderEncodeMaxFileSize = @"encodeMaxFileSize";
25 | SDImageCoderOption const SDImageCoderEncodeEmbedThumbnail = @"encodeEmbedThumbnail";
26 |
27 | SDImageCoderOption const SDImageCoderWebImageContext = @"webImageContext";
28 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageCodersManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDImageCoder.h"
11 |
12 | /**
13 | Global object holding the array of coders, so that we avoid passing them from object to object.
14 | Uses a priority queue behind scenes, which means the latest added coders have the highest priority.
15 | This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data.
16 | That way, users can add their custom coders while preserving our existing prebuilt ones
17 |
18 | Note: the `coders` getter will return the coders in their reversed order
19 | Example:
20 | - by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder`
21 | - calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]`
22 | - call `[addCoder:[MyCrazyCoder new]]`
23 | - calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]`
24 |
25 | Coders
26 | ------
27 | A coder must conform to the `SDImageCoder` protocol or even to `SDProgressiveImageCoder` if it supports progressive decoding
28 | Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat`
29 | Those methods are called on each coder in the array (using the priority order) until one of them returns YES.
30 | That means that coder can decode that data / encode to that format
31 | */
32 | @interface SDImageCodersManager : NSObject
33 |
34 | /**
35 | Returns the global shared coders manager instance.
36 | */
37 | @property (nonatomic, class, readonly, nonnull) SDImageCodersManager *sharedManager;
38 |
39 | /**
40 | All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority
41 | */
42 | @property (nonatomic, copy, nullable) NSArray> *coders;
43 |
44 | /**
45 | Add a new coder to the end of coders array. Which has the highest priority.
46 |
47 | @param coder coder
48 | */
49 | - (void)addCoder:(nonnull id)coder;
50 |
51 | /**
52 | Remove a coder in the coders array.
53 |
54 | @param coder coder
55 | */
56 | - (void)removeCoder:(nonnull id)coder;
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageFrame.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | /**
13 | This class is used for creating animated images via `animatedImageWithFrames` in `SDImageCoderHelper`.
14 | @note If you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+Metadata.h`.
15 | */
16 | @interface SDImageFrame : NSObject
17 |
18 | /**
19 | The image of current frame. You should not set an animated image.
20 | */
21 | @property (nonatomic, strong, readonly, nonnull) UIImage *image;
22 | /**
23 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero.
24 | */
25 | @property (nonatomic, readonly, assign) NSTimeInterval duration;
26 |
27 | /// Create a frame instance with specify image and duration
28 | /// @param image current frame's image
29 | /// @param duration current frame's duration
30 | - (nonnull instancetype)initWithImage:(nonnull UIImage *)image duration:(NSTimeInterval)duration;
31 |
32 | /**
33 | Create a frame instance with specify image and duration
34 |
35 | @param image current frame's image
36 | @param duration current frame's duration
37 | @return frame instance
38 | */
39 | + (nonnull instancetype)frameWithImage:(nonnull UIImage *)image duration:(NSTimeInterval)duration;
40 |
41 | - (nonnull instancetype)init NS_UNAVAILABLE;
42 | + (nonnull instancetype)new NS_UNAVAILABLE;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageFrame.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDImageFrame.h"
10 |
11 | @interface SDImageFrame ()
12 |
13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image;
14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration;
15 |
16 | @end
17 |
18 | @implementation SDImageFrame
19 |
20 | - (instancetype)initWithImage:(UIImage *)image duration:(NSTimeInterval)duration {
21 | self = [super init];
22 | if (self) {
23 | _image = image;
24 | _duration = duration;
25 | }
26 | return self;
27 | }
28 |
29 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration {
30 | SDImageFrame *frame = [[SDImageFrame alloc] initWithImage:image duration:duration];
31 | return frame;
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageGIFCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDImageIOAnimatedCoder.h"
11 |
12 | /**
13 | Built in coder using ImageIO that supports animated GIF encoding/decoding
14 | @note `SDImageIOCoder` supports GIF but only as static (will use the 1st frame).
15 | @note Use `SDImageGIFCoder` for fully animated GIFs. For `UIImageView`, it will produce animated `UIImage`(`NSImage` on macOS) for rendering. For `SDAnimatedImageView`, it will use `SDAnimatedImage` for rendering.
16 | @note The recommended approach for animated GIFs is using `SDAnimatedImage` with `SDAnimatedImageView`. It's more performant than `UIImageView` for GIF displaying(especially on memory usage)
17 | */
18 | @interface SDImageGIFCoder : SDImageIOAnimatedCoder
19 |
20 | @property (nonatomic, class, readonly, nonnull) SDImageGIFCoder *sharedCoder;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageGIFCoder.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 "SDImageGIFCoder.h"
10 | #import "SDImageIOAnimatedCoderInternal.h"
11 | #if SD_MAC
12 | #import
13 | #else
14 | #import
15 | #endif
16 |
17 | @implementation SDImageGIFCoder
18 |
19 | + (instancetype)sharedCoder {
20 | static SDImageGIFCoder *coder;
21 | static dispatch_once_t onceToken;
22 | dispatch_once(&onceToken, ^{
23 | coder = [[SDImageGIFCoder alloc] init];
24 | });
25 | return coder;
26 | }
27 |
28 | #pragma mark - Subclass Override
29 |
30 | + (SDImageFormat)imageFormat {
31 | return SDImageFormatGIF;
32 | }
33 |
34 | + (NSString *)imageUTType {
35 | return (__bridge NSString *)kSDUTTypeGIF;
36 | }
37 |
38 | + (NSString *)dictionaryProperty {
39 | return (__bridge NSString *)kCGImagePropertyGIFDictionary;
40 | }
41 |
42 | + (NSString *)unclampedDelayTimeProperty {
43 | return (__bridge NSString *)kCGImagePropertyGIFUnclampedDelayTime;
44 | }
45 |
46 | + (NSString *)delayTimeProperty {
47 | return (__bridge NSString *)kCGImagePropertyGIFDelayTime;
48 | }
49 |
50 | + (NSString *)loopCountProperty {
51 | return (__bridge NSString *)kCGImagePropertyGIFLoopCount;
52 | }
53 |
54 | + (NSUInteger)defaultLoopCount {
55 | return 1;
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageGraphics.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 | #import
11 |
12 | /**
13 | These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code.
14 | For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage.
15 | For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit.
16 | @note If you don't care bitmap format (ARGB8888) and just draw image, use `SDGraphicsImageRenderer` instead. It's more performant on RAM usage.`
17 | */
18 |
19 | /// Returns the current graphics context.
20 | FOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED;
21 | /// Creates a bitmap-based graphics context and makes it the current context.
22 | FOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size);
23 | /// Creates a bitmap-based graphics context with the specified options.
24 | FOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale);
25 | /// Removes the current bitmap-based graphics context from the top of the stack.
26 | FOUNDATION_EXPORT void SDGraphicsEndImageContext(void);
27 | /// Returns an image based on the contents of the current bitmap-based graphics context.
28 | FOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void);
29 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageHEICCoder.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 "SDImageIOAnimatedCoder.h"
11 |
12 | /**
13 | This coder is used for HEIC (HEIF with HEVC container codec) image format.
14 | Image/IO provide the static HEIC (.heic) support in iOS 11/macOS 10.13/tvOS 11/watchOS 4+.
15 | Image/IO provide the animated HEIC (.heics) support in iOS 13/macOS 10.15/tvOS 13/watchOS 6+.
16 | See https://nokiatech.github.io/heif/technical.html for the standard.
17 | @note This coder is not in the default coder list for now, since HEIC animated image is really rare, and Apple's implementation still contains performance issues. You can enable if you need this.
18 | @note If you need to support lower firmware version for HEIF, you can have a try at https://github.com/SDWebImage/SDWebImageHEIFCoder
19 | */
20 | API_AVAILABLE(ios(13.0), tvos(13.0), macos(10.15), watchos(6.0))
21 | @interface SDImageHEICCoder : SDImageIOAnimatedCoder
22 |
23 | @property (nonatomic, class, readonly, nonnull) SDImageHEICCoder *sharedCoder;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageIOCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDImageCoder.h"
11 |
12 | /**
13 | Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding.
14 |
15 | GIF
16 | Also supports static GIF (meaning will only handle the 1st frame).
17 | For a full GIF support, we recommend `SDAnimatedImageView` to keep both CPU and memory balanced.
18 |
19 | HEIC
20 | This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf
21 | Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13)
22 | Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU))
23 | Encode(Software): macOS 10.13
24 | Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU))
25 | */
26 | @interface SDImageIOCoder : NSObject
27 |
28 | @property (nonatomic, class, readonly, nonnull) SDImageIOCoder *sharedCoder;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDImageLoadersManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDImageLoader.h"
10 |
11 | /**
12 | A loaders manager to manage multiple loaders
13 | */
14 | @interface SDImageLoadersManager : NSObject
15 |
16 | /**
17 | Returns the global shared loaders manager instance. By default we will set [`SDWebImageDownloader.sharedDownloader`] into the loaders array.
18 | */
19 | @property (nonatomic, class, readonly, nonnull) SDImageLoadersManager *sharedManager;
20 |
21 | /**
22 | All image loaders in manager. The loaders array is a priority queue, which means the later added loader will have the highest priority
23 | */
24 | @property (nonatomic, copy, nullable) NSArray>* loaders;
25 |
26 | /**
27 | Add a new image loader to the end of loaders array. Which has the highest priority.
28 |
29 | @param loader loader
30 | */
31 | - (void)addLoader:(nonnull id)loader;
32 |
33 | /**
34 | Remove an image loader in the loaders array.
35 |
36 | @param loader loader
37 | */
38 | - (void)removeLoader:(nonnull id)loader;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageCacheKeyFilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | typedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url);
13 |
14 | /**
15 | This is the protocol for cache key filter.
16 | We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
17 | */
18 | @protocol SDWebImageCacheKeyFilter
19 |
20 | - (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url;
21 |
22 | @end
23 |
24 | /**
25 | A cache key filter class with block.
26 | */
27 | @interface SDWebImageCacheKeyFilter : NSObject
28 |
29 | - (nonnull instancetype)init NS_UNAVAILABLE;
30 | + (nonnull instancetype)new NS_UNAVAILABLE;
31 |
32 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block;
33 | + (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageCacheKeyFilter.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCacheKeyFilter.h"
10 |
11 | @interface SDWebImageCacheKeyFilter ()
12 |
13 | @property (nonatomic, copy, nonnull) SDWebImageCacheKeyFilterBlock block;
14 |
15 | @end
16 |
17 | @implementation SDWebImageCacheKeyFilter
18 |
19 | - (instancetype)initWithBlock:(SDWebImageCacheKeyFilterBlock)block {
20 | self = [super init];
21 | if (self) {
22 | self.block = block;
23 | }
24 | return self;
25 | }
26 |
27 | + (instancetype)cacheKeyFilterWithBlock:(SDWebImageCacheKeyFilterBlock)block {
28 | SDWebImageCacheKeyFilter *cacheKeyFilter = [[SDWebImageCacheKeyFilter alloc] initWithBlock:block];
29 | return cacheKeyFilter;
30 | }
31 |
32 | - (NSString *)cacheKeyForURL:(NSURL *)url {
33 | if (!self.block) {
34 | return nil;
35 | }
36 | return self.block(url);
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageCacheSerializer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | typedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL);
13 |
14 | /**
15 | This is the protocol for cache serializer.
16 | We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
17 | */
18 | @protocol SDWebImageCacheSerializer
19 |
20 | /// Provide the image data associated to the image and store to disk cache
21 | /// @param image The loaded image
22 | /// @param data The original loaded image data. May be nil when image is transformed (UIImage.sd_isTransformed = YES)
23 | /// @param imageURL The image URL
24 | - (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL;
25 |
26 | @end
27 |
28 | /**
29 | A cache serializer class with block.
30 | */
31 | @interface SDWebImageCacheSerializer : NSObject
32 |
33 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block;
34 | + (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block;
35 |
36 | - (nonnull instancetype)init NS_UNAVAILABLE;
37 | + (nonnull instancetype)new NS_UNAVAILABLE;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageCacheSerializer.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCacheSerializer.h"
10 |
11 | @interface SDWebImageCacheSerializer ()
12 |
13 | @property (nonatomic, copy, nonnull) SDWebImageCacheSerializerBlock block;
14 |
15 | @end
16 |
17 | @implementation SDWebImageCacheSerializer
18 |
19 | - (instancetype)initWithBlock:(SDWebImageCacheSerializerBlock)block {
20 | self = [super init];
21 | if (self) {
22 | self.block = block;
23 | }
24 | return self;
25 | }
26 |
27 | + (instancetype)cacheSerializerWithBlock:(SDWebImageCacheSerializerBlock)block {
28 | SDWebImageCacheSerializer *cacheSerializer = [[SDWebImageCacheSerializer alloc] initWithBlock:block];
29 | return cacheSerializer;
30 | }
31 |
32 | - (NSData *)cacheDataWithImage:(UIImage *)image originalData:(NSData *)data imageURL:(nullable NSURL *)imageURL {
33 | if (!self.block) {
34 | return nil;
35 | }
36 | return self.block(image, data, imageURL);
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageCompat.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if !__has_feature(objc_arc)
12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
13 | #endif
14 |
15 | #if !OS_OBJECT_USE_OBJC
16 | #error SDWebImage need ARC for dispatch object
17 | #endif
18 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageDownloaderConfig.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageDownloaderConfig.h"
10 | #import "SDWebImageDownloaderOperation.h"
11 |
12 | static SDWebImageDownloaderConfig * _defaultDownloaderConfig;
13 |
14 | @implementation SDWebImageDownloaderConfig
15 |
16 | + (SDWebImageDownloaderConfig *)defaultDownloaderConfig {
17 | static dispatch_once_t onceToken;
18 | dispatch_once(&onceToken, ^{
19 | _defaultDownloaderConfig = [SDWebImageDownloaderConfig new];
20 | });
21 | return _defaultDownloaderConfig;
22 | }
23 |
24 | - (instancetype)init {
25 | self = [super init];
26 | if (self) {
27 | _maxConcurrentDownloads = 6;
28 | _downloadTimeout = 15.0;
29 | _executionOrder = SDWebImageDownloaderFIFOExecutionOrder;
30 | _acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];
31 | }
32 | return self;
33 | }
34 |
35 | - (id)copyWithZone:(NSZone *)zone {
36 | SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init];
37 | config.maxConcurrentDownloads = self.maxConcurrentDownloads;
38 | config.downloadTimeout = self.downloadTimeout;
39 | config.minimumProgressInterval = self.minimumProgressInterval;
40 | config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone];
41 | config.operationClass = self.operationClass;
42 | config.executionOrder = self.executionOrder;
43 | config.urlCredential = self.urlCredential;
44 | config.username = self.username;
45 | config.password = self.password;
46 | config.acceptableStatusCodes = self.acceptableStatusCodes;
47 | config.acceptableContentTypes = self.acceptableContentTypes;
48 |
49 | return config;
50 | }
51 |
52 | - (void)setOperationClass:(Class)operationClass {
53 | if (operationClass) {
54 | NSAssert([operationClass isSubclassOfClass:[NSOperation class]] && [operationClass conformsToProtocol:@protocol(SDWebImageDownloaderOperation)], @"Custom downloader operation class must subclass NSOperation and conform to `SDWebImageDownloaderOperation` protocol");
55 | }
56 | _operationClass = operationClass;
57 | }
58 |
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageDownloaderDecryptor.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | typedef NSData * _Nullable (^SDWebImageDownloaderDecryptorBlock)(NSData * _Nonnull data, NSURLResponse * _Nullable response);
13 |
14 | /**
15 | This is the protocol for downloader decryptor. Which decrypt the original encrypted data before decoding. Note progressive decoding is not compatible for decryptor.
16 | We can use a block to specify the downloader decryptor. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
17 | */
18 | @protocol SDWebImageDownloaderDecryptor
19 |
20 | /// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm.
21 | /// @param data The original download data
22 | /// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable.
23 | /// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData`
24 | - (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response;
25 |
26 | @end
27 |
28 | /**
29 | A downloader response modifier class with block.
30 | */
31 | @interface SDWebImageDownloaderDecryptor : NSObject
32 |
33 | /// Create the data decryptor with block
34 | /// @param block A block to control decrypt logic
35 | - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block;
36 |
37 | /// Create the data decryptor with block
38 | /// @param block A block to control decrypt logic
39 | + (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block;
40 |
41 | - (nonnull instancetype)init NS_UNAVAILABLE;
42 | + (nonnull instancetype)new NS_UNAVAILABLE;
43 |
44 | @end
45 |
46 | /// Convenience way to create decryptor for common data encryption.
47 | @interface SDWebImageDownloaderDecryptor (Conveniences)
48 |
49 | /// Base64 Encoded image data decryptor
50 | @property (class, readonly, nonnull) SDWebImageDownloaderDecryptor *base64Decryptor;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageDownloaderDecryptor.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 "SDWebImageDownloaderDecryptor.h"
10 |
11 | @interface SDWebImageDownloaderDecryptor ()
12 |
13 | @property (nonatomic, copy, nonnull) SDWebImageDownloaderDecryptorBlock block;
14 |
15 | @end
16 |
17 | @implementation SDWebImageDownloaderDecryptor
18 |
19 | - (instancetype)initWithBlock:(SDWebImageDownloaderDecryptorBlock)block {
20 | self = [super init];
21 | if (self) {
22 | self.block = block;
23 | }
24 | return self;
25 | }
26 |
27 | + (instancetype)decryptorWithBlock:(SDWebImageDownloaderDecryptorBlock)block {
28 | SDWebImageDownloaderDecryptor *decryptor = [[SDWebImageDownloaderDecryptor alloc] initWithBlock:block];
29 | return decryptor;
30 | }
31 |
32 | - (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response {
33 | if (!self.block) {
34 | return nil;
35 | }
36 | return self.block(data, response);
37 | }
38 |
39 | @end
40 |
41 | @implementation SDWebImageDownloaderDecryptor (Conveniences)
42 |
43 | + (SDWebImageDownloaderDecryptor *)base64Decryptor {
44 | static SDWebImageDownloaderDecryptor *decryptor;
45 | static dispatch_once_t onceToken;
46 | dispatch_once(&onceToken, ^{
47 | decryptor = [SDWebImageDownloaderDecryptor decryptorWithBlock:^NSData * _Nullable(NSData * _Nonnull data, NSURLResponse * _Nullable response) {
48 | NSData *modifiedData = [[NSData alloc] initWithBase64EncodedData:data options:NSDataBase64DecodingIgnoreUnknownCharacters];
49 | return modifiedData;
50 | }];
51 | });
52 | return decryptor;
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageDownloaderRequestModifier.h"
10 |
11 | @interface SDWebImageDownloaderRequestModifier ()
12 |
13 | @property (nonatomic, copy, nonnull) SDWebImageDownloaderRequestModifierBlock block;
14 |
15 | @end
16 |
17 | @implementation SDWebImageDownloaderRequestModifier
18 |
19 | - (instancetype)initWithBlock:(SDWebImageDownloaderRequestModifierBlock)block {
20 | self = [super init];
21 | if (self) {
22 | self.block = block;
23 | }
24 | return self;
25 | }
26 |
27 | + (instancetype)requestModifierWithBlock:(SDWebImageDownloaderRequestModifierBlock)block {
28 | SDWebImageDownloaderRequestModifier *requestModifier = [[SDWebImageDownloaderRequestModifier alloc] initWithBlock:block];
29 | return requestModifier;
30 | }
31 |
32 | - (NSURLRequest *)modifiedRequestWithRequest:(NSURLRequest *)request {
33 | if (!self.block) {
34 | return nil;
35 | }
36 | return self.block(request);
37 | }
38 |
39 | @end
40 |
41 | @implementation SDWebImageDownloaderRequestModifier (Conveniences)
42 |
43 | - (instancetype)initWithMethod:(NSString *)method {
44 | return [self initWithMethod:method headers:nil body:nil];
45 | }
46 |
47 | - (instancetype)initWithHeaders:(NSDictionary *)headers {
48 | return [self initWithMethod:nil headers:headers body:nil];
49 | }
50 |
51 | - (instancetype)initWithBody:(NSData *)body {
52 | return [self initWithMethod:nil headers:nil body:body];
53 | }
54 |
55 | - (instancetype)initWithMethod:(NSString *)method headers:(NSDictionary *)headers body:(NSData *)body {
56 | method = method ? [method copy] : @"GET";
57 | headers = [headers copy];
58 | body = [body copy];
59 | return [self initWithBlock:^NSURLRequest * _Nullable(NSURLRequest * _Nonnull request) {
60 | NSMutableURLRequest *mutableRequest = [request mutableCopy];
61 | mutableRequest.HTTPMethod = method;
62 | mutableRequest.HTTPBody = body;
63 | for (NSString *header in headers) {
64 | NSString *value = headers[header];
65 | [mutableRequest setValue:value forHTTPHeaderField:header];
66 | }
67 | return [mutableRequest copy];
68 | }];
69 | }
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageError.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Jamie Pinkham
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "SDWebImageError.h"
11 |
12 | NSErrorDomain const _Nonnull SDWebImageErrorDomain = @"SDWebImageErrorDomain";
13 |
14 | NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey = @"SDWebImageErrorDownloadResponseKey";
15 | NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey = @"SDWebImageErrorDownloadStatusCodeKey";
16 | NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey = @"SDWebImageErrorDownloadContentTypeKey";
17 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 |
11 | /// A protocol represents cancelable operation.
12 | @protocol SDWebImageOperation
13 |
14 | /// Cancel the operation
15 | - (void)cancel;
16 |
17 | @optional
18 |
19 | /// Whether the operation has been cancelled.
20 | @property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
21 |
22 | @end
23 |
24 | /// NSOperation conform to `SDWebImageOperation`.
25 | @interface NSOperation (SDWebImageOperation)
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageOperation.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 "SDWebImageOperation.h"
10 |
11 | /// NSOperation conform to `SDWebImageOperation`.
12 | @implementation NSOperation (SDWebImageOperation)
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/SDWebImage/Core/SDWebImageOptionsProcessor.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 "SDWebImageOptionsProcessor.h"
10 |
11 | @interface SDWebImageOptionsResult ()
12 |
13 | @property (nonatomic, assign) SDWebImageOptions options;
14 | @property (nonatomic, copy, nullable) SDWebImageContext *context;
15 |
16 | @end
17 |
18 | @implementation SDWebImageOptionsResult
19 |
20 | - (instancetype)initWithOptions:(SDWebImageOptions)options context:(SDWebImageContext *)context {
21 | self = [super init];
22 | if (self) {
23 | self.options = options;
24 | self.context = context;
25 | }
26 | return self;
27 | }
28 |
29 | @end
30 |
31 | @interface SDWebImageOptionsProcessor ()
32 |
33 | @property (nonatomic, copy, nonnull) SDWebImageOptionsProcessorBlock block;
34 |
35 | @end
36 |
37 | @implementation SDWebImageOptionsProcessor
38 |
39 | - (instancetype)initWithBlock:(SDWebImageOptionsProcessorBlock)block {
40 | self = [super init];
41 | if (self) {
42 | self.block = block;
43 | }
44 | return self;
45 | }
46 |
47 | + (instancetype)optionsProcessorWithBlock:(SDWebImageOptionsProcessorBlock)block {
48 | SDWebImageOptionsProcessor *optionsProcessor = [[SDWebImageOptionsProcessor alloc] initWithBlock:block];
49 | return optionsProcessor;
50 | }
51 |
52 | - (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {
53 | if (!self.block) {
54 | return nil;
55 | }
56 | return self.block(url, options, context);
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+ExtendedCacheData.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 | @interface UIImage (ExtendedCacheData)
14 |
15 | /**
16 | Read and Write the extended object and bind it to the image. Which can hold some extra metadata like Image's scale factor, URL rich link, date, etc.
17 | The extended object should conforms to NSCoding, which we use `NSKeyedArchiver` and `NSKeyedUnarchiver` to archive it to data, and write to disk cache.
18 | @note The disk cache preserve both of the data and extended data with the same cache key. For manual query, use the `SDDiskCache` protocol method `extendedDataForKey:` instead.
19 | @note You can specify arbitrary object conforms to NSCoding (NSObject protocol here is used to support object using `NS_ROOT_CLASS`, which is not NSObject subclass). If you load image from disk cache, you should check the extended object class to avoid corrupted data.
20 | @warning This object don't need to implements NSSecureCoding (but it's recommended), because we allows arbitrary class.
21 | */
22 | @property (nonatomic, strong, nullable) id sd_extendedObject;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+ExtendedCacheData.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 "UIImage+ExtendedCacheData.h"
11 | #import
12 |
13 | @implementation UIImage (ExtendedCacheData)
14 |
15 | - (id)sd_extendedObject {
16 | return objc_getAssociatedObject(self, @selector(sd_extendedObject));
17 | }
18 |
19 | - (void)setSd_extendedObject:(id)sd_extendedObject {
20 | objc_setAssociatedObject(self, @selector(sd_extendedObject), sd_extendedObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+ForceDecode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | /**
12 | UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior).
13 | */
14 | @interface UIImage (ForceDecode)
15 |
16 | /**
17 | A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode.
18 | Force decode is used for 2 cases:
19 | -- 1. for ImageIO created image (via `CGImageCreateWithImageSource` SPI), it's lazy and we trigger the decode before rendering
20 | -- 2. for non-ImageIO created image (via `CGImageCreate` API), we can ensure it's alignment is suitable to render on screen without copy by CoreAnimation
21 | @note For coder plugin developer, always use the SDImageCoderHelper's `colorSpaceGetDeviceRGB`/`preferredPixelFormat` to create CGImage.
22 | @note For more information why force decode, see: https://github.com/path/FastImageCache#byte-alignment
23 | @note From v5.17.0, the default value is always NO. Use `SDImageForceDecodePolicy` to control complicated policy.
24 | */
25 | @property (nonatomic, assign) BOOL sd_isDecoded;
26 |
27 | /**
28 | Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance.
29 |
30 | @param image The image to be decoded
31 | @return The decoded image
32 | */
33 | + (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image;
34 |
35 | /**
36 | Decode and scale down the provided image
37 |
38 | @param image The image to be decoded
39 | @return The decoded and scaled down image
40 | */
41 | + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
42 |
43 | /**
44 | Decode and scale down the provided image with limit bytes
45 |
46 | @param image The image to be decoded
47 | @param bytes The limit bytes size. Provide 0 to use the build-in limit.
48 | @return The decoded and scaled down image
49 | */
50 | + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+ForceDecode.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImage+ForceDecode.h"
10 | #import "SDImageCoderHelper.h"
11 | #import "objc/runtime.h"
12 | #import "NSImage+Compatibility.h"
13 |
14 | @implementation UIImage (ForceDecode)
15 |
16 | - (BOOL)sd_isDecoded {
17 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isDecoded));
18 | return [value boolValue];
19 | }
20 |
21 | - (void)setSd_isDecoded:(BOOL)sd_isDecoded {
22 | objc_setAssociatedObject(self, @selector(sd_isDecoded), @(sd_isDecoded), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
23 | }
24 |
25 | + (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image {
26 | if (!image) {
27 | return nil;
28 | }
29 | return [SDImageCoderHelper decodedImageWithImage:image];
30 | }
31 |
32 | + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image {
33 | return [self sd_decodedAndScaledDownImageWithImage:image limitBytes:0];
34 | }
35 |
36 | + (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes {
37 | if (!image) {
38 | return nil;
39 | }
40 | return [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes];
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+GIF.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Laurin Brandner
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "SDWebImageCompat.h"
11 |
12 | /**
13 | This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directly use `SDImageCoder`.
14 | */
15 | @interface UIImage (GIF)
16 |
17 | /**
18 | Creates an animated UIImage from an NSData.
19 | This will create animated image if the data is Animated GIF. And will create a static image is the data is Static GIF.
20 |
21 | @param data The GIF data
22 | @return The created image
23 | */
24 | + (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+GIF.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Laurin Brandner
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "UIImage+GIF.h"
11 | #import "SDImageGIFCoder.h"
12 |
13 | @implementation UIImage (GIF)
14 |
15 | + (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data {
16 | if (!data) {
17 | return nil;
18 | }
19 | return [[SDImageGIFCoder sharedCoder] decodedImageWithData:data options:0];
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+MemoryCacheCost.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | /**
12 | UIImage category for memory cache cost.
13 | */
14 | @interface UIImage (MemoryCacheCost)
15 |
16 | /**
17 | The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory.
18 | If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost.
19 |
20 | For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Return full frame bytes size when `image.images` is not nil for animated image.
21 | For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory.
22 | @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods.
23 | @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes.
24 | */
25 | @property (assign, nonatomic) NSUInteger sd_memoryCost;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIImage+MemoryCacheCost.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImage+MemoryCacheCost.h"
10 | #import "objc/runtime.h"
11 | #import "NSImage+Compatibility.h"
12 |
13 | FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) {
14 | CGImageRef imageRef = image.CGImage;
15 | if (!imageRef) {
16 | return 0;
17 | }
18 | NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef);
19 | NSUInteger frameCount;
20 | #if SD_MAC
21 | frameCount = 1;
22 | #elif SD_UIKIT || SD_WATCH
23 | // Filter the same frame in `_UIAnimatedImage`.
24 | frameCount = image.images.count > 1 ? [NSSet setWithArray:image.images].count : 1;
25 | #endif
26 | NSUInteger cost = bytesPerFrame * frameCount;
27 | return cost;
28 | }
29 |
30 | @implementation UIImage (MemoryCacheCost)
31 |
32 | - (NSUInteger)sd_memoryCost {
33 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost));
34 | NSUInteger memoryCost;
35 | if (value != nil) {
36 | memoryCost = [value unsignedIntegerValue];
37 | } else {
38 | memoryCost = SDMemoryCacheCostForImage(self);
39 | }
40 | return memoryCost;
41 | }
42 |
43 | - (void)setSd_memoryCost:(NSUInteger)sd_memoryCost {
44 | objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIView+WebCacheOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 | #import "SDWebImageOperation.h"
11 |
12 | /**
13 | These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external.
14 | All the stored operations are weak, so it will be dealloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.
15 | */
16 | @interface UIView (WebCacheOperation)
17 |
18 | /**
19 | * Get the image load operation for key
20 | *
21 | * @param key key for identifying the operations
22 | * @return the image load operation
23 | * @note If key is nil, means using the NSStringFromClass(self.class) instead, match the behavior of `operation key`
24 | */
25 | - (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key;
26 |
27 | /**
28 | * Set the image load operation (storage in a UIView based weak map table)
29 | *
30 | * @param operation the operation, should not be nil or no-op will perform
31 | * @param key key for storing the operation
32 | * @note If key is nil, means using the NSStringFromClass(self.class) instead, match the behavior of `operation key`
33 | */
34 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key;
35 |
36 | /**
37 | * Cancel the operation for the current UIView and key
38 | *
39 | * @param key key for identifying the operations
40 | * @note If key is nil, means using the NSStringFromClass(self.class) instead, match the behavior of `operation key`
41 | */
42 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key;
43 |
44 | /**
45 | * Just remove the operation corresponding to the current UIView and key without cancelling them
46 | *
47 | * @param key key for identifying the operations.
48 | * @note If key is nil, means using the NSStringFromClass(self.class) instead, match the behavior of `operation key`
49 | */
50 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIView+WebCacheState.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | /**
13 | A loading state to manage View Category which contains multiple states. Like UIImgeView.image && UIImageView.highlightedImage
14 | @code
15 | SDWebImageLoadState *loadState = [self sd_imageLoadStateForKey:@keypath(self, highlitedImage)];
16 | NSProgress *highlitedImageProgress = loadState.progress;
17 | @endcode
18 | */
19 | @interface SDWebImageLoadState : NSObject
20 |
21 | /**
22 | Image loading URL
23 | */
24 | @property (nonatomic, strong, nullable) NSURL *url;
25 | /**
26 | Image loading progress. The unit count is the received size and excepted size of download.
27 | */
28 | @property (nonatomic, strong, nullable) NSProgress *progress;
29 |
30 | @end
31 |
32 | /**
33 | These methods are used for WebCache view which have multiple states for image loading, for example, `UIButton` or `UIImageView.highlightedImage`
34 | It maitain the state container for per-operation, make it possible for control and check each image loading operation's state.
35 | @note For developer who want to add SDWebImage View Category support for their own stateful class, learn more on Wiki.
36 | */
37 | @interface UIView (WebCacheState)
38 |
39 | /**
40 | Get the image loading state container for specify operation key
41 |
42 | @param key key for identifying the operations
43 | @return The image loading state container
44 | */
45 | - (nullable SDWebImageLoadState *)sd_imageLoadStateForKey:(nullable NSString *)key;
46 |
47 | /**
48 | Set the image loading state container for specify operation key
49 |
50 | @param state The image loading state container
51 | @param key key for identifying the operations
52 | */
53 | - (void)sd_setImageLoadState:(nullable SDWebImageLoadState *)state forKey:(nullable NSString *)key;
54 |
55 | /**
56 | Rmove the image loading state container for specify operation key
57 |
58 | @param key key for identifying the operations
59 | */
60 | - (void)sd_removeImageLoadStateForKey:(nullable NSString *)key;
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/SDWebImage/Core/UIView+WebCacheState.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+WebCacheState.h"
10 | #import "objc/runtime.h"
11 |
12 | typedef NSMutableDictionary SDStatesDictionary;
13 |
14 | @implementation SDWebImageLoadState
15 |
16 | @end
17 |
18 | @implementation UIView (WebCacheState)
19 |
20 | - (SDStatesDictionary *)sd_imageLoadStateDictionary {
21 | SDStatesDictionary *states = objc_getAssociatedObject(self, @selector(sd_imageLoadStateDictionary));
22 | if (!states) {
23 | states = [NSMutableDictionary dictionary];
24 | objc_setAssociatedObject(self, @selector(sd_imageLoadStateDictionary), states, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
25 | }
26 | return states;
27 | }
28 |
29 | - (SDWebImageLoadState *)sd_imageLoadStateForKey:(NSString *)key {
30 | if (!key) {
31 | key = NSStringFromClass(self.class);
32 | }
33 | @synchronized(self) {
34 | return [self.sd_imageLoadStateDictionary objectForKey:key];
35 | }
36 | }
37 |
38 | - (void)sd_setImageLoadState:(SDWebImageLoadState *)state forKey:(NSString *)key {
39 | if (!key) {
40 | key = NSStringFromClass(self.class);
41 | }
42 | @synchronized(self) {
43 | self.sd_imageLoadStateDictionary[key] = state;
44 | }
45 | }
46 |
47 | - (void)sd_removeImageLoadStateForKey:(NSString *)key {
48 | if (!key) {
49 | key = NSStringFromClass(self.class);
50 | }
51 | @synchronized(self) {
52 | self.sd_imageLoadStateDictionary[key] = nil;
53 | }
54 | }
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_MAC
12 |
13 | #import "UIImage+Transform.h"
14 |
15 | @interface NSBezierPath (SDRoundedCorners)
16 |
17 | /**
18 | Convenience way to create a bezier path with the specify rounding corners on macOS. Same as the one on `UIBezierPath`.
19 | */
20 | + (nonnull instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius;
21 |
22 | @end
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "NSBezierPath+SDRoundedCorners.h"
10 |
11 | #if SD_MAC
12 |
13 | @implementation NSBezierPath (SDRoundedCorners)
14 |
15 | + (instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius {
16 | NSBezierPath *path = [NSBezierPath bezierPath];
17 |
18 | CGFloat maxCorner = MIN(NSWidth(rect), NSHeight(rect)) / 2;
19 |
20 | CGFloat topLeftRadius = MIN(maxCorner, (corners & SDRectCornerTopLeft) ? cornerRadius : 0);
21 | CGFloat topRightRadius = MIN(maxCorner, (corners & SDRectCornerTopRight) ? cornerRadius : 0);
22 | CGFloat bottomLeftRadius = MIN(maxCorner, (corners & SDRectCornerBottomLeft) ? cornerRadius : 0);
23 | CGFloat bottomRightRadius = MIN(maxCorner, (corners & SDRectCornerBottomRight) ? cornerRadius : 0);
24 |
25 | NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect));
26 | NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect));
27 | NSPoint bottomLeft = NSMakePoint(NSMinX(rect), NSMinY(rect));
28 | NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect));
29 |
30 | [path moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))];
31 | [path appendBezierPathWithArcFromPoint:topLeft toPoint:bottomLeft radius:topLeftRadius];
32 | [path appendBezierPathWithArcFromPoint:bottomLeft toPoint:bottomRight radius:bottomLeftRadius];
33 | [path appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:bottomRightRadius];
34 | [path appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:topRightRadius];
35 | [path closePath];
36 |
37 | return path;
38 | }
39 |
40 | @end
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDAssociatedObject.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 | /// Copy the associated object from source image to target image. The associated object including all the category read/write properties.
12 | /// @param source source
13 | /// @param target target
14 | FOUNDATION_EXPORT void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target);
15 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDAssociatedObject.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 "SDAssociatedObject.h"
10 | #import "UIImage+Metadata.h"
11 | #import "UIImage+ExtendedCacheData.h"
12 | #import "UIImage+MemoryCacheCost.h"
13 | #import "UIImage+ForceDecode.h"
14 |
15 | void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target) {
16 | if (!source || !target) {
17 | return;
18 | }
19 | // Image Metadata
20 | target.sd_isIncremental = source.sd_isIncremental;
21 | target.sd_isTransformed = source.sd_isTransformed;
22 | target.sd_decodeOptions = source.sd_decodeOptions;
23 | target.sd_imageLoopCount = source.sd_imageLoopCount;
24 | target.sd_imageFormat = source.sd_imageFormat;
25 | // Force Decode
26 | target.sd_isDecoded = source.sd_isDecoded;
27 | // Extended Cache Data
28 | target.sd_extendedObject = source.sd_extendedObject;
29 | }
30 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDAsyncBlockOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | @class SDAsyncBlockOperation;
12 | typedef void (^SDAsyncBlock)(SDAsyncBlockOperation * __nonnull asyncOperation);
13 |
14 | /// A async block operation, success after you call `completer` (not like `NSBlockOperation` which is for sync block, success on return)
15 | @interface SDAsyncBlockOperation : NSOperation
16 |
17 | - (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block;
18 | + (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block;
19 | - (void)complete;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDDeviceHelper.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 | /// Device information helper methods
13 | @interface SDDeviceHelper : NSObject
14 |
15 | + (NSUInteger)totalMemory;
16 | + (NSUInteger)freeMemory;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDDeviceHelper.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 "SDDeviceHelper.h"
10 | #import
11 | #import
12 |
13 | @implementation SDDeviceHelper
14 |
15 | + (NSUInteger)totalMemory {
16 | return (NSUInteger)[[NSProcessInfo processInfo] physicalMemory];
17 | }
18 |
19 | + (NSUInteger)freeMemory {
20 | mach_port_t host_port = mach_host_self();
21 | mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
22 | vm_size_t page_size;
23 | vm_statistics_data_t vm_stat;
24 | kern_return_t kern;
25 |
26 | kern = host_page_size(host_port, &page_size);
27 | if (kern != KERN_SUCCESS) return 0;
28 | kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size);
29 | if (kern != KERN_SUCCESS) return 0;
30 | return vm_stat.free_count * page_size;
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDDisplayLink.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 | /// Cross-platform display link wrapper. Do not retain the target
13 | /// Use `CADisplayLink` on iOS/tvOS, `CVDisplayLink` on macOS, `NSTimer` on watchOS
14 | @interface SDDisplayLink : NSObject
15 |
16 | @property (readonly, nonatomic, weak, nullable) id target;
17 | @property (readonly, nonatomic, assign, nonnull) SEL selector;
18 | @property (readonly, nonatomic) NSTimeInterval duration; // elapsed time in seconds of previous callback. (or it's first callback, use the time between `start` and callback). Always zero when display link not running
19 | @property (readonly, nonatomic) BOOL isRunning;
20 |
21 | + (nonnull instancetype)displayLinkWithTarget:(nonnull id)target selector:(nonnull SEL)sel;
22 |
23 | - (void)addToRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode;
24 | - (void)removeFromRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode;
25 |
26 | - (void)start;
27 | - (void)stop;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDFileAttributeHelper.h:
--------------------------------------------------------------------------------
1 | //
2 | // This file is from https://gist.github.com/zydeco/6292773
3 | //
4 | // Created by Jesús A. Álvarez on 2008-12-17.
5 | // Copyright 2008-2009 namedfork.net. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | /// File Extended Attribute (xattr) helper methods
11 | @interface SDFileAttributeHelper : NSObject
12 |
13 | + (nullable NSArray *)extendedAttributeNamesAtPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;
14 | + (BOOL)hasExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;
15 | + (nullable NSData *)extendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;
16 | + (BOOL)setExtendedAttribute:(nonnull NSString *)name value:(nonnull NSData *)value atPath:(nonnull NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError * _Nullable * _Nullable)err;
17 | + (BOOL)removeExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDImageAssetManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | /// A Image-Asset manager to work like UIKit/AppKit's image cache behavior
13 | /// Apple parse the Asset Catalog compiled file(`Assets.car`) by CoreUI.framework, however it's a private framework and there are no other ways to directly get the data. So we just process the normal bundle files :)
14 | @interface SDImageAssetManager : NSObject
15 |
16 | @property (nonatomic, strong, nonnull) NSMapTable *imageTable;
17 |
18 | + (nonnull instancetype)sharedAssetManager;
19 | - (nullable NSString *)getPathForName:(nonnull NSString *)name bundle:(nonnull NSBundle *)bundle preferredScale:(nonnull CGFloat *)scale;
20 | - (nullable UIImage *)imageForName:(nonnull NSString *)name;
21 | - (void)storeImage:(nonnull UIImage *)image forName:(nonnull NSString *)name;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDImageCachesManagerOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | /// This is used for operation management, but not for operation queue execute
13 | @interface SDImageCachesManagerOperation : NSOperation
14 |
15 | @property (nonatomic, assign, readonly) NSUInteger pendingCount;
16 |
17 | - (void)beginWithTotalCount:(NSUInteger)totalCount;
18 | - (void)completeOne;
19 | - (void)done;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDImageCachesManagerOperation.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDImageCachesManagerOperation.h"
10 | #import "SDInternalMacros.h"
11 |
12 | @implementation SDImageCachesManagerOperation {
13 | SD_LOCK_DECLARE(_pendingCountLock);
14 | }
15 |
16 | @synthesize executing = _executing;
17 | @synthesize finished = _finished;
18 | @synthesize cancelled = _cancelled;
19 | @synthesize pendingCount = _pendingCount;
20 |
21 | - (instancetype)init {
22 | if (self = [super init]) {
23 | SD_LOCK_INIT(_pendingCountLock);
24 | _pendingCount = 0;
25 | }
26 | return self;
27 | }
28 |
29 | - (void)beginWithTotalCount:(NSUInteger)totalCount {
30 | self.executing = YES;
31 | self.finished = NO;
32 | _pendingCount = totalCount;
33 | }
34 |
35 | - (NSUInteger)pendingCount {
36 | SD_LOCK(_pendingCountLock);
37 | NSUInteger pendingCount = _pendingCount;
38 | SD_UNLOCK(_pendingCountLock);
39 | return pendingCount;
40 | }
41 |
42 | - (void)completeOne {
43 | SD_LOCK(_pendingCountLock);
44 | _pendingCount = _pendingCount > 0 ? _pendingCount - 1 : 0;
45 | SD_UNLOCK(_pendingCountLock);
46 | }
47 |
48 | - (void)cancel {
49 | self.cancelled = YES;
50 | [self reset];
51 | }
52 |
53 | - (void)done {
54 | self.finished = YES;
55 | self.executing = NO;
56 | [self reset];
57 | }
58 |
59 | - (void)reset {
60 | SD_LOCK(_pendingCountLock);
61 | _pendingCount = 0;
62 | SD_UNLOCK(_pendingCountLock);
63 | }
64 |
65 | - (void)setFinished:(BOOL)finished {
66 | [self willChangeValueForKey:@"isFinished"];
67 | _finished = finished;
68 | [self didChangeValueForKey:@"isFinished"];
69 | }
70 |
71 | - (void)setExecuting:(BOOL)executing {
72 | [self willChangeValueForKey:@"isExecuting"];
73 | _executing = executing;
74 | [self didChangeValueForKey:@"isExecuting"];
75 | }
76 |
77 | - (void)setCancelled:(BOOL)cancelled {
78 | [self willChangeValueForKey:@"isCancelled"];
79 | _cancelled = cancelled;
80 | [self didChangeValueForKey:@"isCancelled"];
81 | }
82 |
83 | @end
84 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDImageFramePool.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 "SDImageCoder.h"
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | /// A per-provider (provider means, AnimatedImage object) based frame pool, each player who use the same provider share the same frame buffer
16 | @interface SDImageFramePool : NSObject
17 |
18 | /// Register and return back a frame pool, also increase reference count
19 | + (instancetype)registerProvider:(id)provider;
20 | /// Unregister a frame pool, also decrease reference count, if zero dealloc the frame pool
21 | + (void)unregisterProvider:(id)provider;
22 |
23 | /// Prefetch the current frame, query using `frameAtIndex:` by caller to check whether finished.
24 | - (void)prefetchFrameAtIndex:(NSUInteger)index;
25 |
26 | /// Control the max buffer count for current frame pool, used for RAM/CPU balance, default unlimited
27 | @property (nonatomic, assign) NSUInteger maxBufferCount;
28 | /// Control the max concurrent fetch queue operation count, used for CPU balance, default 1
29 | @property (nonatomic, assign) NSUInteger maxConcurrentCount;
30 |
31 | // Frame Operations
32 | @property (nonatomic, readonly) NSUInteger currentFrameCount;
33 | - (nullable UIImage *)frameAtIndex:(NSUInteger)index;
34 | - (void)setFrame:(nullable UIImage *)frame atIndex:(NSUInteger)index;
35 | - (void)removeFrameAtIndex:(NSUInteger)index;
36 | - (void)removeAllFrames;
37 |
38 | NS_ASSUME_NONNULL_END
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDImageIOAnimatedCoderInternal.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
11 | #import "SDImageIOAnimatedCoder.h"
12 |
13 | // AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation
14 | #define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic")
15 | #define kSDUTTypeHEIF ((__bridge CFStringRef)@"public.heif")
16 | // HEIC Sequence (Animated Image)
17 | #define kSDUTTypeHEICS ((__bridge CFStringRef)@"public.heics")
18 | // kSDUTTypeWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :)
19 | #define kSDUTTypeWebP ((__bridge CFStringRef)@"org.webmproject.webp")
20 |
21 | #define kSDUTTypeImage ((__bridge CFStringRef)@"public.image")
22 | #define kSDUTTypeJPEG ((__bridge CFStringRef)@"public.jpeg")
23 | #define kSDUTTypePNG ((__bridge CFStringRef)@"public.png")
24 | #define kSDUTTypeTIFF ((__bridge CFStringRef)@"public.tiff")
25 | #define kSDUTTypeSVG ((__bridge CFStringRef)@"public.svg-image")
26 | #define kSDUTTypeGIF ((__bridge CFStringRef)@"com.compuserve.gif")
27 | #define kSDUTTypePDF ((__bridge CFStringRef)@"com.adobe.pdf")
28 | #define kSDUTTypeBMP ((__bridge CFStringRef)@"com.microsoft.bmp")
29 | #define kSDUTTypeRAW ((__bridge CFStringRef)@"public.camera-raw-image")
30 |
31 | @interface SDImageIOAnimatedCoder ()
32 |
33 | + (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source;
34 | + (NSUInteger)imageLoopCountWithSource:(nonnull CGImageSourceRef)source;
35 | + (nullable UIImage *)createFrameAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize lazyDecode:(BOOL)lazyDecode animatedImage:(BOOL)animatedImage;
36 | + (BOOL)canEncodeToFormat:(SDImageFormat)format;
37 | + (BOOL)canDecodeFromFormat:(SDImageFormat)format;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDInternalMacros.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDInternalMacros.h"
10 |
11 | os_log_t sd_getDefaultLog(void) {
12 | static dispatch_once_t onceToken;
13 | static os_log_t log;
14 | dispatch_once(&onceToken, ^{
15 | log = os_log_create("com.hackemist.SDWebImage", "Default");
16 | });
17 | return log;
18 | }
19 |
20 | void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block) {
21 | (*block)();
22 | }
23 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDWeakProxy.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | /// A weak proxy which forward all the message to the target
13 | @interface SDWeakProxy : NSProxy
14 |
15 | @property (nonatomic, weak, readonly, nullable) id target;
16 |
17 | - (nonnull instancetype)initWithTarget:(nonnull id)target;
18 | + (nonnull instancetype)proxyWithTarget:(nonnull id)target;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDWeakProxy.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWeakProxy.h"
10 |
11 | @implementation SDWeakProxy
12 |
13 | - (instancetype)initWithTarget:(id)target {
14 | _target = target;
15 | return self;
16 | }
17 |
18 | + (instancetype)proxyWithTarget:(id)target {
19 | return [[SDWeakProxy alloc] initWithTarget:target];
20 | }
21 |
22 | - (id)forwardingTargetForSelector:(SEL)selector {
23 | return _target;
24 | }
25 |
26 | - (void)forwardInvocation:(NSInvocation *)invocation {
27 | void *null = NULL;
28 | [invocation setReturnValue:&null];
29 | }
30 |
31 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
32 | return [NSObject instanceMethodSignatureForSelector:@selector(init)];
33 | }
34 |
35 | - (BOOL)respondsToSelector:(SEL)aSelector {
36 | return [_target respondsToSelector:aSelector];
37 | }
38 |
39 | - (BOOL)isEqual:(id)object {
40 | return [_target isEqual:object];
41 | }
42 |
43 | - (NSUInteger)hash {
44 | return [_target hash];
45 | }
46 |
47 | - (Class)superclass {
48 | return [_target superclass];
49 | }
50 |
51 | - (Class)class {
52 | return [_target class];
53 | }
54 |
55 | - (BOOL)isKindOfClass:(Class)aClass {
56 | return [_target isKindOfClass:aClass];
57 | }
58 |
59 | - (BOOL)isMemberOfClass:(Class)aClass {
60 | return [_target isMemberOfClass:aClass];
61 | }
62 |
63 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol {
64 | return [_target conformsToProtocol:aProtocol];
65 | }
66 |
67 | - (BOOL)isProxy {
68 | return YES;
69 | }
70 |
71 | - (NSString *)description {
72 | return [_target description];
73 | }
74 |
75 | - (NSString *)debugDescription {
76 | return [_target debugDescription];
77 | }
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/SDWebImage/Private/SDWebImageTransitionInternal.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 | /// Helper method for Core Animation transition
16 | FOUNDATION_EXPORT CAMediaTimingFunction * _Nullable SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options);
17 | FOUNDATION_EXPORT CATransition * _Nullable SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options);
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/SDWebImage/Private/UIColor+SDHexString.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | @interface UIColor (SDHexString)
12 |
13 | /**
14 | Convenience way to get hex string from color. The output should always be 32-bit RGBA hex string like `#00000000`.
15 | */
16 | @property (nonatomic, copy, readonly, nonnull) NSString *sd_hexString;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/SDWebImage/Private/UIColor+SDHexString.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIColor+SDHexString.h"
10 |
11 | @implementation UIColor (SDHexString)
12 |
13 | - (NSString *)sd_hexString {
14 | CGFloat red, green, blue, alpha;
15 | #if SD_UIKIT
16 | if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) {
17 | [self getWhite:&red alpha:&alpha];
18 | green = red;
19 | blue = red;
20 | }
21 | #else
22 | @try {
23 | [self getRed:&red green:&green blue:&blue alpha:&alpha];
24 | }
25 | @catch (NSException *exception) {
26 | [self getWhite:&red alpha:&alpha];
27 | green = red;
28 | blue = red;
29 | }
30 | #endif
31 |
32 | red = roundf(red * 255.f);
33 | green = roundf(green * 255.f);
34 | blue = roundf(blue * 255.f);
35 | alpha = roundf(alpha * 255.f);
36 |
37 | uint hex = ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue);
38 |
39 | return [NSString stringWithFormat:@"#%08x", hex];
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/SDWebImage/Resources/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 | ../../WebImage/PrivacyInfo.xcprivacy
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/NSButton+WebCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/NSButton+WebCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/NSData+ImageContentType.h:
--------------------------------------------------------------------------------
1 | ../../Core/NSData+ImageContentType.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/NSImage+Compatibility.h:
--------------------------------------------------------------------------------
1 | ../../Core/NSImage+Compatibility.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDAnimatedImage.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDAnimatedImage.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDAnimatedImagePlayer.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDAnimatedImagePlayer.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDAnimatedImageRep.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDAnimatedImageRep.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDAnimatedImageView+WebCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDAnimatedImageView+WebCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDAnimatedImageView.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDAnimatedImageView.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDCallbackQueue.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDCallbackQueue.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDDiskCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDDiskCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDGraphicsImageRenderer.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDGraphicsImageRenderer.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageAPNGCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageAPNGCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageAWebPCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageAWebPCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCacheConfig.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCacheConfig.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCacheDefine.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCacheDefine.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCachesManager.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCachesManager.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCoderHelper.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCoderHelper.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageCodersManager.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageCodersManager.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageFrame.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageFrame.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageGIFCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageGIFCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageGraphics.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageGraphics.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageHEICCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageHEICCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageIOAnimatedCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageIOAnimatedCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageIOCoder.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageIOCoder.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageLoader.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageLoader.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageLoadersManager.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageLoadersManager.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDImageTransformer.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDImageTransformer.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDMemoryCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDMemoryCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImage.h:
--------------------------------------------------------------------------------
1 | ../../../WebImage/SDWebImage.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageCacheKeyFilter.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageCacheKeyFilter.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageCacheSerializer.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageCacheSerializer.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageCompat.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageCompat.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDefine.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDefine.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDownloader.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDownloader.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDownloaderConfig.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDownloaderConfig.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDownloaderDecryptor.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDownloaderDecryptor.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDownloaderOperation.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDownloaderOperation.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDownloaderRequestModifier.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDownloaderRequestModifier.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageDownloaderResponseModifier.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageDownloaderResponseModifier.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageError.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageError.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageIndicator.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageIndicator.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageManager.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageManager.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageOperation.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageOperation.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageOptionsProcessor.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageOptionsProcessor.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImagePrefetcher.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImagePrefetcher.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/SDWebImageTransition.h:
--------------------------------------------------------------------------------
1 | ../../Core/SDWebImageTransition.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIButton+WebCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIButton+WebCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+ExtendedCacheData.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+ExtendedCacheData.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+ForceDecode.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+ForceDecode.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+GIF.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+GIF.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+MemoryCacheCost.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+MemoryCacheCost.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+Metadata.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+Metadata.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+MultiFormat.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+MultiFormat.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImage+Transform.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImage+Transform.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImageView+HighlightedWebCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImageView+HighlightedWebCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIImageView+WebCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIImageView+WebCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIView+WebCache.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIView+WebCache.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIView+WebCacheOperation.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIView+WebCacheOperation.h
--------------------------------------------------------------------------------
/SDWebImage/include/SDWebImage/UIView+WebCacheState.h:
--------------------------------------------------------------------------------
1 | ../../Core/UIView+WebCacheState.h
--------------------------------------------------------------------------------
/SDWebImageMapKit/Resources/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 | ../../WebImage/PrivacyInfo.xcprivacy
--------------------------------------------------------------------------------
/SDWebImageMapKit/include/SDWebImageMapKit/MKAnnotationView+WebCache.h:
--------------------------------------------------------------------------------
1 | ../../MapKit/MKAnnotationView+WebCache.h
--------------------------------------------------------------------------------
/SDWebImageMapKit/include/SDWebImageMapKit/SDWebImageMapKit.h:
--------------------------------------------------------------------------------
1 | ../../../WebImage/SDWebImageMapKit.h
--------------------------------------------------------------------------------
/SDWebImage_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/SDWebImage_logo.png
--------------------------------------------------------------------------------
/SDWebImage_logo_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/SDWebImage_logo_small.png
--------------------------------------------------------------------------------
/Scripts/build-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -o pipefail
5 |
6 | XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
7 | XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
8 | XCODE_VERSION_MINOR=$(echo $XCODE_VERSION | awk -F '.' '{print $2}')
9 | XCODE_VERSION_PATCH=$(echo $XCODE_VERSION | awk -F '.' '{print $3}')
10 | if [ -z "$SRCROOT" ]
11 | then
12 | SRCROOT=$(pwd)
13 | fi
14 |
15 | mkdir -p "${SRCROOT}/build"
16 | PLATFORMS=("iOS" "iOSSimulator" "macOS" "tvOS" "tvOSSimulator" "watchOS" "watchOSSimulator")
17 |
18 | if [ $XCODE_VERSION_MAJOR -ge 11 ]
19 | then
20 | PLATFORMS+=("macCatalyst")
21 | fi
22 |
23 | if [[ ($XCODE_VERSION_MAJOR -gt 15) || ($XCODE_VERSION_MAJOR -eq 15 && $XCODE_VERSION_MINOR -ge 2) ]]
24 | then
25 | PLATFORMS+=("visionOS")
26 | PLATFORMS+=("visionOSSimulator")
27 | fi
28 |
29 | for CURRENT_PLATFORM in "${PLATFORMS[@]}"
30 | do
31 | DESTINATION="generic/platform=${CURRENT_PLATFORM}"
32 |
33 | # macOS Catalyst
34 | if [[ $CURRENT_PLATFORM == "macCatalyst" ]]; then
35 | DESTINATION="generic/platform=macOS,variant=Mac Catalyst"
36 | fi
37 |
38 | # Simulator
39 | if [[ $CURRENT_PLATFORM == *Simulator ]]; then
40 | CURRENT_PLATFORM_OS=${CURRENT_PLATFORM%Simulator}
41 | DESTINATION="generic/platform=${CURRENT_PLATFORM_OS} Simulator"
42 | fi
43 |
44 | if [[ $MACH_O_TYPE == "staticlib" ]]; then
45 | XCCCONFIG_PATH="${SRCROOT}/Configs/Static.xcconfig"
46 | else
47 | XCCCONFIG_PATH="${SRCROOT}/Configs/Dynamic.xcconfig"
48 | fi
49 |
50 | xcodebuild build -project "SDWebImage.xcodeproj" -destination "${DESTINATION}" -scheme "SDWebImage" -configuration "Release" -xcconfig "${XCCCONFIG_PATH}" -derivedDataPath "${SRCROOT}/build/DerivedData" CONFIGURATION_BUILD_DIR="${SRCROOT}/build/${CURRENT_PLATFORM}/"
51 | done
52 |
--------------------------------------------------------------------------------
/Scripts/create-xcframework.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -o pipefail
5 |
6 | XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
7 | XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
8 | XCODE_VERSION_MINOR=$(echo $XCODE_VERSION | awk -F '.' '{print $2}')
9 | XCODE_VERSION_PATCH=$(echo $XCODE_VERSION | awk -F '.' '{print $3}')
10 | if [ -z "$SRCROOT" ]
11 | then
12 | SRCROOT=$(pwd)
13 | fi
14 |
15 | if [ $XCODE_VERSION_MAJOR -lt 11 ]
16 | then
17 | echo "Xcode 10 does not support xcframework. You can still use the individual framework for each platform."
18 | open -a Finder "${SRCROOT}/build/"
19 | exit 0
20 | fi
21 |
22 | mkdir -p "${SRCROOT}/build"
23 | PLATFORMS=("iOS" "iOSSimulator" "macOS" "tvOS" "tvOSSimulator" "watchOS" "watchOSSimulator")
24 |
25 | if [ $XCODE_VERSION_MAJOR -ge 11 ]
26 | then
27 | PLATFORMS+=("macCatalyst")
28 | fi
29 |
30 | if [[ ($XCODE_VERSION_MAJOR -gt 15) || ($XCODE_VERSION_MAJOR -eq 15 && $XCODE_VERSION_MINOR -ge 2) ]]
31 | then
32 | PLATFORMS+=("visionOS")
33 | PLATFORMS+=("visionOSSimulator")
34 | fi
35 |
36 | COMMAND_ARGS=""
37 | for CURRENT_PLATFORM in "${PLATFORMS[@]}"
38 | do
39 | COMMAND_ARGS="${COMMAND_ARGS} -framework ${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.framework"
40 | if [[ $MACH_O_TYPE != "staticlib" ]]; then
41 | COMMAND_ARGS="${COMMAND_ARGS} -debug-symbols ${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.framework.dSYM"
42 | fi
43 | done
44 |
45 | # Combine XCFramework
46 | echo "Create XCFramework"
47 | xcodebuild -create-xcframework $COMMAND_ARGS -output "${SRCROOT}/build/SDWebImage.xcframework"
48 |
--------------------------------------------------------------------------------
/Scripts/sign-xcframework.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 | set -o pipefail
6 |
7 | if [ -z "$SRCROOT" ]
8 | then
9 | SRCROOT=$(pwd)
10 | fi
11 |
12 | # Self-sign XCFramework
13 | if [ -z $CODESIGN_KEY_BASE64 ]; then
14 | echo "Ignore Codesign XCFramework! You must sign SDWebImage before shipping to App Store. See: https://developer.apple.com/support/third-party-SDK-requirements"
15 | exit 0
16 | fi
17 |
18 | KEYCHAIN=~/Library/Keychains/ios.keychain
19 | KEYCHAIN_PASSWORD=SDWebImage
20 | CODESIGN_IDENTIFY_NAME=SDWebImage\ Signing\ Certificate
21 | KEY_PASSWORD=""
22 |
23 | echo $CODESIGN_KEY_BASE64 | base64 -D > "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.p12"
24 |
25 | security create-keychain -p "$KEYCHAIN_PASSWORD" ios.keychain
26 | security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN
27 |
28 | security import "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.cer" -k $KEYCHAIN -T /usr/bin/codesign
29 | security import "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.p12" -k $KEYCHAIN -P "$KEY_PASSWORD" -T /usr/bin/codesign
30 | security list-keychains -s ios.keychain
31 | security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" $KEYCHAIN
32 |
33 | echo "Codesign XCFramework"
34 | /usr/bin/codesign --force --timestamp -v --sign "SDWebImage Signing Certificate" "${SRCROOT}/build/SDWebImage.xcframework"
35 |
36 | rm -rf "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.p12"
37 | security delete-keychain ios.keychain
--------------------------------------------------------------------------------
/Tests/Expecta.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Expecta'
3 | s.version = '1.0.6'
4 | s.license = { :type => 'MIT', :file => 'LICENSE' }
5 | s.summary = 'A matcher framework for Objective-C & Cocoa.'
6 | s.homepage = 'http://github.com/petejkim/expecta'
7 | s.author = { 'Peter Jihoon Kim' => 'raingrove@gmail.com' }
8 |
9 | s.source = { :git => 'https://github.com/specta/expecta.git', :tag => "v#{s.version}" }
10 |
11 | s.description = %{
12 | Expecta is a matcher framework for Objective-C and Cocoa. The main
13 | advantage of using Expecta over other matcher frameworks is that you do not
14 | have to specify the data types. Also, the syntax of Expecta matchers is
15 | much more readable and does not suffer from parenthesitis. If you have used
16 | Jasmine before, you will feel right at home!
17 | }
18 |
19 | s.source_files = 'Expecta/**/*.{h,m}'
20 |
21 | s.requires_arc = false
22 | s.ios.deployment_target = '9.0'
23 | s.osx.deployment_target = '10.11'
24 | s.tvos.deployment_target = '9.0'
25 | s.watchos.deployment_target = '2.0'
26 | s.visionos.deployment_target = '1.0'
27 |
28 | s.frameworks = 'Foundation', 'XCTest'
29 | s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
30 | s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(PLATFORM_DIR)/Developer/Library/Frameworks' }
31 | end
32 |
--------------------------------------------------------------------------------
/Tests/KVOController.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |spec|
2 | spec.name = 'KVOController'
3 | spec.version = '1.2.0'
4 | spec.license = { :type => 'BSD' }
5 | spec.homepage = 'https://github.com/facebook/KVOController'
6 | spec.authors = { 'Kimon Tsinteris' => 'kimon@mac.com', 'Nikita Lutsenko' => 'nlutsenko@me.com' }
7 | spec.summary = 'Simple, modern, thread-safe key-value observing.'
8 | spec.description = <<-DESC
9 | KVOController builds on Cocoa's time-tested key-value observing implementation. It offers a simple, modern API, that is also thread safe.
10 | Benefits include:
11 | Notification using blocks, custom actions, or NSKeyValueObserving callback.
12 | No exceptions on observer removal.
13 | Implicit observer removal on controller dealloc.
14 | Thread-safety with special guards against observer resurrection.
15 | DESC
16 | spec.source = { :git => 'https://github.com/facebook/KVOController.git', :tag => "v#{spec.version.to_s}" }
17 | spec.source_files = 'FBKVOController/*.{h,m}'
18 | spec.requires_arc = true
19 |
20 | spec.ios.deployment_target = '9.0'
21 | spec.osx.deployment_target = '10.11'
22 | spec.tvos.deployment_target = '9.0'
23 | spec.watchos.deployment_target = '2.0'
24 | spec.visionos.deployment_target = '1.0'
25 | end
26 |
--------------------------------------------------------------------------------
/Tests/Tests Mac/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Tests/Tests TV/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Tests/Tests Vision/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Tests/Tests/Images/1@2x.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/1@2x.gif
--------------------------------------------------------------------------------
/Tests/Tests/Images/IndexedPNG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/IndexedPNG.png
--------------------------------------------------------------------------------
/Tests/Tests/Images/MonochromeTestImage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/MonochromeTestImage.jpg
--------------------------------------------------------------------------------
/Tests/Tests/Images/RGBA16PNG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/RGBA16PNG.png
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestAnimatedImageMemory.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestAnimatedImageMemory.webp
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestEXIF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestEXIF.png
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestICCProfile.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestICCProfile.jpg
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.bmp
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.gif
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.heic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.heic
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.heif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.heif
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.jpg
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.nef:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.nef
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.pdf
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImage.png
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImage.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImageAnimated.apng:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImageAnimated.apng
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImageAnimated.heics:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImageAnimated.heics
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImageAnimated.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImageAnimated.webp
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImageLarge.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImageLarge.jpg
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImageLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImageLarge.png
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestImageStatic.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestImageStatic.webp
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestJFIF.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestJFIF.jpg
--------------------------------------------------------------------------------
/Tests/Tests/Images/TestLoopCount.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorgamer001/SDWebImage/15f6675966dafc3228e061b8e7e4f450286d274a/Tests/Tests/Images/TestLoopCount.gif
--------------------------------------------------------------------------------
/Tests/Tests/SDMockFileManager.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 | // This is a mock class to provide custom error for methods
12 | @interface SDMockFileManager : NSFileManager
13 |
14 | @property (nonatomic, strong, readonly, nullable) NSError *lastError;
15 |
16 | @property (nonatomic, copy, nullable) NSDictionary *mockSelectors; // used to specify mocked selectors which will return NO with specify error instead of normal process. If you specify a NSNull, will use nil instead.
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Tests/Tests/SDMockFileManager.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 "SDMockFileManager.h"
10 |
11 | @interface SDMockFileManager ()
12 |
13 | @property (nonatomic, strong, nullable) NSError *lastError;
14 |
15 | @end
16 |
17 | @implementation SDMockFileManager
18 |
19 | - (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError * _Nullable __autoreleasing *)error {
20 | self.lastError = nil;
21 | NSError *mockError = [self.mockSelectors objectForKey:NSStringFromSelector(_cmd)];
22 | if ([mockError isEqual:[NSNull null]]) {
23 | if (error) {
24 | *error = nil;
25 | }
26 | return NO;
27 | } else if (mockError) {
28 | if (error) {
29 | *error = mockError;
30 | }
31 | self.lastError = mockError;
32 | return NO;
33 | } else {
34 | return [super createDirectoryAtPath:path withIntermediateDirectories:createIntermediates attributes:attributes error:error];
35 | }
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Tests/Tests/SDTestCase.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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 | #define EXP_SHORTHAND // required by Expecta
11 |
12 |
13 | #import
14 | #import
15 | #import
16 |
17 | #if SD_MAC
18 | #define UIWindow NSWindow
19 | #define UIScreen NSScreen
20 | #endif
21 |
22 | FOUNDATION_EXPORT const int64_t kAsyncTestTimeout;
23 | FOUNDATION_EXPORT const int64_t kMinDelayNanosecond;
24 | FOUNDATION_EXPORT NSString * _Nonnull const kTestJPEGURL;
25 | FOUNDATION_EXPORT NSString * _Nonnull const kTestProgressiveJPEGURL;
26 | FOUNDATION_EXPORT NSString * _Nonnull const kTestPNGURL;
27 | FOUNDATION_EXPORT NSString * _Nonnull const kTestGIFURL;
28 | FOUNDATION_EXPORT NSString * _Nonnull const kTestAPNGPURL;
29 |
30 | @interface SDTestCase : XCTestCase
31 |
32 | @property (nonatomic, strong, null_resettable) UIWindow *window;
33 | @property (nonatomic, readonly, class, getter=isCI) BOOL CI; // Check if GitHub CI
34 |
35 | - (void)waitForExpectationsWithCommonTimeout;
36 | - (void)waitForExpectationsWithCommonTimeoutUsingHandler:(nullable XCWaitCompletionHandler)handler;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestCache.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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
12 | #import
13 |
14 | // A really naive implementation of custom memory cache and disk cache
15 | @interface SDWebImageTestMemoryCache : NSObject
16 |
17 | @property (nonatomic, strong, nonnull) SDImageCacheConfig *config;
18 | @property (nonatomic, strong, nonnull) NSCache *cache;
19 |
20 | @end
21 |
22 | @interface SDWebImageTestDiskCache : NSObject
23 |
24 | @property (nonatomic, strong, nonnull) SDImageCacheConfig *config;
25 | @property (nonatomic, copy, nonnull) NSString *cachePath;
26 | @property (nonatomic, strong, nonnull) NSFileManager *fileManager;
27 |
28 | @end
29 |
30 | // A really naive implementation of custom image cache using memory cache and disk cache
31 | @interface SDWebImageTestCache : NSObject
32 |
33 | @property (nonatomic, strong, nonnull) SDImageCacheConfig *config;
34 | @property (nonatomic, strong, nonnull) SDWebImageTestMemoryCache *memoryCache;
35 | @property (nonatomic, strong, nonnull) SDWebImageTestDiskCache *diskCache;
36 |
37 | - (nullable instancetype)initWithCachePath:(nonnull NSString *)cachePath config:(nonnull SDImageCacheConfig *)config;
38 |
39 | @property (nonatomic, class, readonly, nonnull) SDWebImageTestCache *sharedCache;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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
12 |
13 | @interface SDWebImageTestCoder : NSObject
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestCoder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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 "SDWebImageTestCoder.h"
11 |
12 | @implementation SDWebImageTestCoder
13 |
14 | - (BOOL)canDecodeFromData:(nullable NSData *)data {
15 | return YES;
16 | }
17 |
18 | - (BOOL)canEncodeToFormat:(SDImageFormat)format {
19 | return YES;
20 | }
21 |
22 | - (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options {
23 | NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
24 | UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
25 | return image;
26 | }
27 |
28 | - (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options
29 | {
30 | self = [super init];
31 | if (self) {
32 | }
33 | return self;
34 | }
35 |
36 | - (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished {
37 | return;
38 | }
39 |
40 | - (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options {
41 | NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"gif"];
42 | UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
43 | return image;
44 | }
45 |
46 | - (BOOL)canIncrementalDecodeFromData:(NSData *)data {
47 | return YES;
48 | }
49 |
50 | - (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options {
51 | NSString *testString = @"TestEncode";
52 | NSData *data = [testString dataUsingEncoding:NSUTF8StringEncoding];
53 | return data;
54 | }
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestDownloadOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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
12 |
13 | /**
14 | * A class that fits the NSOperation+SDWebImageDownloaderOperation requirement so we can test
15 | */
16 | @interface SDWebImageTestDownloadOperation : NSOperation
17 |
18 | @property (nonatomic, strong, nullable) NSURLRequest *request;
19 | @property (nonatomic, strong, nullable) NSURLResponse *response;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestLoader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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
12 |
13 | // A really naive implementation of custom image loader using `NSURLSession`
14 | @interface SDWebImageTestLoader : NSObject
15 |
16 | @property (nonatomic, class, readonly, nonnull) SDWebImageTestLoader *sharedLoader;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestTransformer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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 | @interface SDWebImageTestTransformer : NSObject
13 |
14 | @property (nonatomic, assign) BOOL preserveImageMetadata;
15 |
16 | @property (nonatomic, strong, nullable) UIImage *testImage;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Tests/Tests/SDWebImageTestTransformer.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Matt Galloway
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 "SDWebImageTestTransformer.h"
11 |
12 | @implementation SDWebImageTestTransformer
13 |
14 | - (instancetype)init {
15 | self = [super init];
16 | if (self) {
17 | _preserveImageMetadata = YES;
18 | }
19 | return self;
20 | }
21 |
22 | - (NSString *)transformerKey {
23 | return @"SDWebImageTestTransformer";
24 | }
25 |
26 | - (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
27 | return self.testImage;
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Tests/Tests/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 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Tests/Tests/Tests-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #ifdef __OBJC__
8 | #import
9 | #import
10 | #endif
11 |
--------------------------------------------------------------------------------
/WebImage/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 5.20.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 5.20.0
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/WebImage/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyTracking
6 |
7 | NSPrivacyCollectedDataTypes
8 |
9 | NSPrivacyTrackingDomains
10 |
11 | NSPrivacyAccessedAPITypes
12 |
13 |
14 | NSPrivacyAccessedAPIType
15 | NSPrivacyAccessedAPICategoryFileTimestamp
16 | NSPrivacyAccessedAPITypeReasons
17 |
18 | C617.1
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/WebImage/SDWebImageMapKit.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Florent Vilmart
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import
11 |
12 | //! Project version number for SDWebImageMapKit.
13 | FOUNDATION_EXPORT double SDWebImageMapKitVersionNumber;
14 |
15 | //! Project version string for SDWebImageMapKit.
16 | FOUNDATION_EXPORT const unsigned char SDWebImageMapKitVersionString[];
17 |
18 | // In this header, you should import all the public headers of your framework using statements like #import
19 |
20 | // MapKit
21 | #import
22 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | ignore:
3 | - "Examples"
4 | - "Vendors"
5 | - "Tests"
6 | status:
7 | project:
8 | default: off
9 | ios:
10 | flags:
11 | - ios
12 | macos:
13 | flags:
14 | - macos
15 | tvos:
16 | flags:
17 | - tvos
18 |
--------------------------------------------------------------------------------