Swiftpack.co - conmulligan/vinci as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by conmulligan.
conmulligan/vinci 0.3.0
Asynchronous image downloader and cache for iOS.
⭐️ 1
🕓 3 years ago
iOS
.package(url: "https://github.com/conmulligan/vinci.git", from: "0.3.0")

Vinci

CI Status Version License Platform

Vinci is an asynchronous image downloader and cache for iOS.

Note: Vinci is early in development and, although stable, is missing some important features.

Roadmap

Done

  • Asychronous image downloading (0.1.0).
  • Download queue (0.1.0).
  • Combined memory and disk cache (0.1.0).
  • Image modifiers (0.2.0).
  • Support for caching images post-modification (0.2.0).

Outstanding

  • Automatic cache expiration.
  • UIImageView binding.

Usage

You can use the shared Vinci singleton and the request factory method to fetch an image like so:

Vinci.shared.request(with: url) { (image, isCached) in
    imageView.image = image
}

A Vinci instance can also initialized with custom URLSession and VinciCache instances:

let session = URLSession.shared
let cache = VinciCache()
let vinci = Vinci(session: session, cache: cache)

Modifiers

You can pass an optional array of Modifiers to change the image before it's passed to the completion hander:

let modifiers: [Modifier] = [
    MonoModifier(color: UIColor.gray, intensity: 1.0),
    ScaleModifier(size: imageView.frame.size)
]
Vinci.shared.request(with: url, modifiers: modifiers) { (image, isCached) in
    imageView.image = image
}

Vinci includes a number of modifiers by default:

  • ScaleModifier scales an image to a specific size.
  • MonoModifier uses CIColorMonochrome to color tint an image.
  • ClosureModifier accepts a closure which applies a custom modification.

Additional modifiers can be created by implementing the Modifier protocol.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Vinci is available through CocoaPods. To install it, add the following line to your Podfile:

pod 'Vinci'

Author

Conor Mulligan, [email protected]

License

Vinci is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 1
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics