Latest 0.1.1
Homepage https://github.com/SDWebImage/SDWebImageYYPlugin
License MIT
Platforms ios 8.0
Dependencies SDWebImage/Core
Authors

CI Status
Version
License
Platform
Carthage compatible
codecov

What’s for

SDWebImageYYPlugin is a plugin for SDWebImage framework, which provide the image loading support for YYImage (including YYImage’s decoding system and YYAnimatedImageView) and YYCache cache system.

By using SDWebImageYYPlugin, you can use all you familiar SDWebImage’s loading method, on the YYAnimatedImageView.

And you can also use YYCache 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 sqlite blob storage)

Usage

YYImage Plugin

To load a network image, simply call the View Category method like UIImageView.

  • Objective-C
YYAnimatedImageView *imageView;
[imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.gif"]];
  • Swift
let imageView: YYAnimatedImageView
imageView.sd_setImage(with: URL(string: "http://www.domain.com/path/to/image.gif"))

For advanced user, you can embed YYImageDecoder && YYImageEncoder to SDWebImage by using the wrapper class SDImageYYCoder. See Custom Coder wiki in SDWebImage.

  • Objective-C
// Register YYImage decoder/encoder as coder plugin
[SDImageCodersManager.sharedManager addCoder:SDImageYYCoder.sharedCoder];
  • Swift
// Register YYImage decoder/encoder as coder plugin
SDImageCodersManager.shared.addCoder(SDImageYYCoder.shared)

YYCache Plugin

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

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

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

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

Requirements

  • iOS 8+
  • Xcode 9+

Installation

CocoaPods

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

pod 'SDWebImageYYPlugin'

SDWebImageYYPlugin contains two subspecs, YYCache and YYImage. You can choose to enable only some of them. By default will contains all subspecs.

pod 'SDWebImageYYPlugin/YYImage'
pod 'SDWebImageYYPlugin/YYCache'

Carthage

SDWebImageFLPlugin is available through Carthage.

github "SDWebImage/SDWebImageYYPlugin"

Carthage does not support like CocoaPods’ subspec, the built framework will contains both YYCache && YYImage support.

Note because of limit of YYImage Carthage support, YYImage plugin with Carthage will not support WebP format. If you want to support WebP format, use CocoaPods instead.

Author

DreamPiggy, [email protected]

License

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

Latest podspec

{
    "name": "SDWebImageYYPlugin",
    "version": "0.1.1",
    "summary": "A short description of SDWebImageYYPlugin.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/SDWebImage/SDWebImageYYPlugin",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "DreamPiggy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SDWebImage/SDWebImageYYPlugin.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SDWebImageYYPlugin/Module/SDWebImageYYPlugin.h",
    "module_map": "SDWebImageYYPlugin/Module/SDWebImageYYPlugin.modulemap",
    "dependencies": {
        "SDWebImage/Core": [
            ">= 5.0.0-beta3"
        ]
    },
    "subspecs": [
        {
            "name": "YYCache",
            "dependencies": {
                "YYCache": []
            },
            "source_files": [
                "SDWebImageYYPlugin/Classes/YYCache/**/*",
                "SDWebImageYYPlugin/Module/SDWebImageYYPlugin.h"
            ]
        },
        {
            "name": "YYImage",
            "dependencies": {
                "YYImage/Core": []
            },
            "source_files": [
                "SDWebImageYYPlugin/Classes/YYImage/**/*",
                "SDWebImageYYPlugin/Module/SDWebImageYYPlugin.h"
            ]
        }
    ]
}

Pin It on Pinterest

Share This