59

GitHub - folio-sec/ImagePipeline: Folio Image Pipeline is an image loading and c...

 5 years ago
source link: https://github.com/folio-sec/ImagePipeline
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Build Status

ImagePipeline

Folio Image Pipeline is an image loading and caching framework for iOS clients

Usage

let imagePipeline = ImagePipeline()
imagePipeline.shared.load(/* image URL */, into: /* image view */, transition: .fadeIn /* default is `.none`*/,
                          defaultImage: ..., failureImage: ...)

Example

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! Cell

    ImagePipeline.shared.load(urls[indexPath.row % 200],
                              into: cell.imageView,
                              transition: .fadeIn,
                              defaultImage: UIImage(named: "loading")!,
                              failureImage: UIImage(named: "failed")!)
    
    return cell
}

Supported content types

  • ✅ PNG
  • ✅ JPEG
  • ✅ GIF
  • ✅ WebP

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK