Git Product home page Git Product logo

sdwebimageyyplugin's Introduction

SDWebImageYYPlugin

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:@"name"];
  • 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 9+
  • Xcode 11+

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.

sdwebimageyyplugin's People

Contributors

bpoplauschi avatar dreampiggy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.