/Elkon

A modern image loading framework in Swift

Primary LanguageSwiftMIT LicenseMIT

Elkon

A modern image loading framework in Swift (supports PNG, JPG, GIF, WEBP)

Carthage Compatible

Installation

Carthage

To integrate Elkon into your Xcode project using Carthage, specify it in your Cartfile:

github "zetasq/Elkon"

Run carthage update to build the framework. Elkon has SwiftCache and CWebP as dependencies. Drag the built Elkon.framework, SwiftCache.framework and CWebP.framework into your Xcode project.

Usage

Instead of using bare UIImageView, you create ElkonImageView (a light-weight subclass of UIImageView) to access the powerful Elkon APIs.

let iconView = ElkonImageView()

// load image by url (supports local file url)
iconView.elkon.loadImage(at: URL(string: "my-image-url"), placeholder: UIImage(named: "iconPlaceholder", animated: true)

// load UIImage directly
let image = UIImage(named: "icon-image")
iconView.elkon.load(uiImage: image, placeholder: nil, animated: true)

// Image resizing and cornerRadius support
let renderConfig = ImageRenderConfig(sizeInPoints: CGSize(width: 50, height: 50), cornerRadiusInPoints: 5, scaleMode: .fill)
iconView.elkon.loadImage(at: URL(string: "my-image-url"), renderConfig: renderConfig, placeholder: nil, animated: true)

License

Elkon is released under the MIT license. See LICENSE for details.