Latest 0.3.0
Homepage https://github.com/jinSasaki/Vulcan
License MIT
Platforms ios 8.0, tvos 9.0
Authors

Build Status
Carthage compatible
Version
Platform

Multi image downloader with priority in Swift

Features

  • Very light
  • Multi image download with priority
  • Caching images
  • Pure Swift
  • Composable image
  • Support WebP
Single download Multi download with priority
demo_01 demo_02

Installation

CocoaPods

Setup CocoaPods:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build Vulcan

Podfile

platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' 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

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.

import Vulcan
import SwiftWebP // Only installed via Carthage

extension 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 8.0+
  • Xcode 8.1+
  • Swift 3.0.1+

Latest podspec

{
    "name": "Vulcan",
    "version": "0.3.0",
    "license": "MIT",
    "summary": "Multi image downloader with priority in Swift",
    "homepage": "https://github.com/jinSasaki/Vulcan",
    "social_media_url": "http://twitter.com/sasakky_j",
    "authors": {
        "Jin Sasaki": "[email protected].com"
    },
    "source": {
        "git": "https://github.com/jinSasaki/Vulcan.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source_files": "Sources/**/*.swift",
    "pushed_with_swift_version": "3.1",
    "subspecs": [
        {
            "name": "WebP",
            "source_files": "Sources/WebP/*.{h,m,swift}",
            "xcconfig": {
                "USER_HEADER_SEARCH_PATHS": "$(inherited) $(SRCROOT)/libwebp/src"
            },
            "dependencies": {
                "libwebp": []
            }
        }
    ]
}

Pin It on Pinterest

Share This