Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jinSasaki/Vulcan
Multi image downloader with priority in Swift
https://github.com/jinSasaki/Vulcan
carthage cocoapods image swift swift-3 webp
Last synced: 6 days ago
JSON representation
Multi image downloader with priority in Swift
- Host: GitHub
- URL: https://github.com/jinSasaki/Vulcan
- Owner: jinSasaki
- License: mit
- Created: 2016-10-20T14:52:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-25T06:01:12.000Z (about 7 years ago)
- Last Synced: 2024-11-24T01:42:06.104Z (18 days ago)
- Topics: carthage, cocoapods, image, swift, swift-3, webp
- Language: Swift
- Homepage:
- Size: 3.28 MB
- Stars: 292
- Watchers: 7
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Vulcan - Multi image downloader with priority in Swift. (Media / Image)
- awesome-swift - Vulcan - Multi image downloader with priority. (Libs / Images)
- awesome-ios-star - Vulcan - Multi image downloader with priority in Swift. (Media / Image)
- awesome-swift - Vulcan - Multi image downloader with priority in Swift ` 📝 4 years ago ` (Images [🔝](#readme))
README
Vulcan
=====
[![Build Status](https://travis-ci.org/jinSasaki/Vulcan.svg?branch=master)](https://travis-ci.org/jinSasaki/Vulcan)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Version](https://img.shields.io/cocoapods/v/Vulcan.svg?style=flat)](http://cocoadocs.org/docsets/Vulcan)
[![Platform](https://img.shields.io/cocoapods/p/Vulcan.svg?style=flat)](http://cocoadocs.org/docsets/Vulcan)Multi image downloader with priority in Swift
## Features
- Very light
- Multi image download with priority
- Caching images
- Pure Swift
- Composable image
- Support WebPSingle download | Multi download with priority
--- | ---
![demo_01](https://github.com/jinSasaki/Vulcan/raw/master/assets/demo_01.gif) | ![demo_02](https://github.com/jinSasaki/Vulcan/raw/master/assets/demo_02.gif)## Installation
### CocoaPods
Setup CocoaPods:```
$ gem install cocoapods
```> CocoaPods 1.1.0+ is required to build Vulcan
`Podfile`
```
platform :ios, '8.0'
use_frameworks!target '' do
pod 'Vulcan'
end```
Then, run the following command:
```
$ pod install
```### Carthage
Setup carthage:```
$ brew update
$ brew install carthage
````Cartfile`
```
github "jinSasaki/Vulcan"
```## Usage
### Image downloading and show
```swift
import Vulcan// Single downloading
imageView.vl.setImage(url: URL(string: "/path/to/image")!)// Multi downloading
// This image will be overridden by the image of higher priority URL.
imageView.vl.setImage(urls: [
.url(URL(string: "/path/to/image")!, priority: 100),
.url(URL(string: "/path/to/image")!, priority: 1000)
])
```### WebP image
If you installed via CocoaPods, add `pod 'Vulcan/WebP'`.
If you installed via Carthage, add `SwiftWebP.framework` to project.```swift
import Vulcan
import SwiftWebP // Only installed via Carthageextension WebPDecoder: ImageDecoder {
public func decode(data: Data, response: HTTPURLResponse, options: ImageDecodeOptions?) throws -> Image {
let contentTypes = response.allHeaderFields.filter({ ($0.key as? String ?? "").lowercased() == "content-type" })
guard
let contentType = contentTypes.first,
let value = contentType.value as? String,
value == "image/webp",
let image = WebPDecoder.decode(data) else {
return try DefaultImageDecoder().decode(data: data, response: response, options: options)
}
return image
}
}// Set decoder to shared ImageDownloader
Vulcan.defaultImageDownloader.decoder = WebPDecoder()// Request image with URL
imageView.vl.setImage(url: URL(string: "/path/to/image")!)
```## Requirements
- iOS 9.0+
- Xcode 8.1+
- Swift 3.0.1+