Swiftpack.co - SDWebImage/SDWebImagePINPlugin as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A SDWebImage plugin to integrate PINCache for custom image caching
.package(url: "https://github.com/SDWebImage/SDWebImagePINPlugin.git", from: "0.3.0")


CI Status Version License Platform Carthage compatible SwiftPM compatible codecov

What's for

SDWebImagePINPlugin is a plugin for SDWebImage framework, which provide the image loading support for PINCache cache system.

You use PINCache instead of SDImageCache for image cache system, which may better memory cache performance (By taking advanced of LRU algorithm), and disk cache performance (By taking advanced of queue management and age/bytes LRU algorithm)



To enable PINCache instead of SDImageCache, you can bind the cache for shared manager, or create a custom manager instead.

  • Objective-C
// Use `PINCache` for shared manager
SDWebImageManger.defaultImageCache = [PINCache cacheWithName:@"name"];
  • Swift
// Use `PINCache` for shared manager
SDWebImageManger.defaultImageCache = PINCache(name: "name")

You can also attach the custom cache for individual image requests via .imageCache context option.

  • Objective-C
// Use `PINCache` for single URL request
[imageView sd_setImageWithURL:url placeholderImage:nil options:0 context:@{SDWebImageContextImageCache: @(pinCache)} progress:nil completion:completion];
  • Swift
// Use `PINCache` for single URL request
imageView.sd_setImage(with: url, placeholderImage: nil, context: [.imageCache : pinCache], progress: nil, completion: completion);

PINDiskCache && PINMemoryCache

You can also use PINMemoryCache or PINDiskcache to customize memory cache / disk cache only. See Custom Cache wiki in SDWebImage.

  • Objective-C
// Use `PINMemoryCache` for shared `SDImageCache` memory cache implementation
SDImageCacheConfig.defaultCacheConfig.memoryCacheClass = PINMemoryCache.class;
// Use `PINDiskcache` for shared `SDImageCache` disk cache implementation
SDImageCacheConfig.defaultCacheConfig.diskCacheClass = PINDiskcache.class;
  • Swift
// Use `PINMemoryCache` for `SDImageCache` memory cache implementation
SDImageCacheConfig.default.memoryCacheClass = PINMemoryCache.self
// Use `PINDiskcache` for `SDImageCache` disk cache implementation
SDImageCacheConfig.default.diskCacheClass = PINDiskcache.self


  • iOS 9+
  • tvOS 9+
  • macOS 10.11+
  • watchOS 2.0+
  • Xcode 11+



SDWebImagePINPlugin is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SDWebImagePINPlugin'


SDWebImagePINPlugin is available through Carthage.

github "SDWebImage/SDWebImagePINPlugin"

Swift Package Manager (Xcode 11+)

SDWebImagePINPlugin is available through Swift Package Manager.

let package = Package(
    dependencies: [
        .package(url: "https://github.com/SDWebImage/SDWebImagePINPlugin.git", from: "0.3.0")


DreamPiggy, lizhuoli1126@126.com


SDWebImagePINPlugin is available under the MIT license. See the LICENSE file for more info.


Stars: 5
Last commit: 31 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

0.3.0 - SwiftPM && iOS9+
31 weeks ago


  • Added SwiftPM support #3
  • Bumped the min deployment target to iOS 9+, Xcode to Xcode 11 #2


  • Sync the SDImageCache logic from SDWebImage 5.10.0 #4

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics