SwiftyImageCache 1.2.2

SwiftyImageCache 1.2.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2017
SwiftSwift Version 4.0
SPMSupports SPM

Maintained by Luan Tran.



  • By
  • noblakit01

SwiftyImageCache

Codacy Badge

Helper framework to cache image with url in Swift iOS.

Requirements

  • iOS 8.0+
  • Xcode 8+
  • Swift 3

Installation

CocoaPods

To integrate PhotoCollectionView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'SwiftyImageCache', '~> 1.1.2'

Then, run the following command:

$ pod install

Manually

  • Drag and drop Sources folder into your project.

Usage

Convenient UIImageView

Set url to imageview.

imageView.setUrl(url)

Design for UITableView/UICollectionView asynchronous image. Only need setUrl from any UIImageView in UITableViewCell/UICollectionViewCell.

ImageCache

Use ImageCache object to cache your image from URL

	let cache = ImageCache()
	cache.loadImage(atUrl: url, completion: { (urlString, image) in
	})

or use default cache

	ImageCache.default.loadImage(atUrl: url, completion: { (urlString, image) in
	})

CacheType

You can config cacheType

	ImageCache.default.cacheType = .disk // (default mode, recommendation)
	ImageCache.default.cacheType = .ram

TODO

Todo

License

MIT