Latest 1.1.4
Homepage https://github.com/lucianobohrer/Valley
License MIT
Platforms ios 10.0
Authors

Valley, a file downloader written in Swift 4 for iOS

ValleyValleyValley

  • Images are downloaded asynchronously.
  • LRU concept to cache management
  • Allows to configure cache size.
  • Has extension for UIImageView
  • Provides closure properties manipulation and error handling.

TODO List

  • [x] In Memory Cache
  • [ ] Disk Storage Cache
  • [x] Improve cache item size
  • [ ] New extensions (e.g. WKWebView)
  • [x] Travis integration

    Setup

Setup with CocoaPods (iOS 10+)

If you are using CocoaPods add this text to your Podfile and run pod install.

use_frameworks!
target 'Your target name'
pod 'Valley'

Usage

  1. Add import Valley to your code

  2. From your UIImageView instance, you can just:
    imageView.valleyImage(url: "https://yourwebseite.com/img.jpeg")
  3. To download other kind of files for example:
    
    // JSON
    ValleyFile<[[String: Any]]>.request(url: "https://yourwebsite.com/data.json") { (json) in }

// Data to fill a webview with a PDF
ValleyFile.request(url: "https://yourwebsite.com/myfile.pdf") { (data) in }

## Canceling download

To manually cancel the download, call:
```Swift
let task = imageView.valleyImage(url: "https://yourwebseite.com/img.jpeg")
task.cancel()

Supply a placeholder image

You can supply an error image that will be used if an error occurs during image download.

imageView.valleyImage(url: "https://yourwebseite.com/img.jpeg", placeholder: image)

Cache

The following method clear all items from cache

Valley.cache.clearCache()

Settings

Use Valley.setup(capacity: Int) to define a capacity in bytes to cache.

Demo app

The demo iOS app shows how to load images in a collection view with Valley and also load files like JSON.

Alternative solutions

Here is the list of other image download libraries for Swift.

License

Valley is released under the MIT License.

Feedback is welcome

If you notice any issue, got stuck or just want to chat feel free to create an issue. I will be happy to help you.

•ᴥ•

Latest podspec

{
    "name": "Valley",
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.2.0",
    "summary": "A simple loading and caching system for Images, Data and JSONS",
    "version": "1.1.4",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Luciano Bohrer": "[email protected]"
    },
    "homepage": "https://github.com/lucianobohrer/Valley",
    "source": {
        "git": "https://github.com/lucianobohrer/Valley.git",
        "tag": "1.1.4"
    },
    "ios": {
        "frameworks": "Foundation"
    },
    "source_files": "Valley/Source/**/*"
}

Pin It on Pinterest

Share This