Folio Image Pipeline is an image loading and caching framework for iOS clients
Clone or download
Latest commit ab1c8fb Jan 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Configurations First commit Dec 31, 2018
ImagePipeline.xcodeproj Add blur filter Jan 5, 2019
ImagePipeline Changed to generate `directives` using reduce function. Jan 21, 2019
ImagePipelineTests Add testParseCacheControlHeader Jan 21, 2019
Scripts Refactor Jan 19, 2019
Vendor/webp First commit Dec 31, 2018
.gitignore First commit Dec 31, 2018
Cartfile.private First commit Dec 31, 2018
Cartfile.resolved First commit Dec 31, 2018
LICENSE Initial commit Dec 31, 2018
README.md Update README.md Jan 6, 2019

README.md

Build Status Carthage compatible

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
}

Resize

Aspect Fit (Default)

let resizer = ImageResizer(targetSize: CGSize(width: 400, height: 400))
ImagePipeline.shared.load(/* imageURL */, into: /* image view */, processors: [resizer])
Original Resized
1 testimageresizeraspectfit 1

Aspect Fill

let resizer = ImageResizer(targetSize: CGSize(width: 400, height: 400), contentMode: .aspectFill)
ImagePipeline.shared.load(/* imageURL */, into: /* image view */, processors: [resizer])
Original Resized
1 testimageresizeraspectfill 1

Resize & Blur

let scale: CGFloat = 2
let size = CGSize(width: 375 * scale, height: 232 * scale)
let resizer = ImageResizer(targetSize: size, contentMode: .aspectFill)
let filter = BlurFilter(style: .light)

ImagePipeline.shared.load(/* imageURL */, into: /* image view */, processors: [resizer, filter])
Original Blurred
resize testblurfilter 2

TTL

ImagePipeline respects the max-age value of Cache-Control response header, and sets independent TTL for each image.

Supported content types

PNG
JPEG
GIF
WebP