3pillarlabs/iOS-AssetsCaching

Name: iOS-AssetsCaching

Owner: 3Pillar Global Open Source

Description: This framework aims to provide a light and easy to use way to retrieve and cache data files from a provided url.

Created: 2017-10-10 14:35:57.0

Updated: 2017-10-10 15:32:17.0

Pushed: 2017-10-10 15:50:11.0

Homepage: null

Size: 1088

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Asset Caching

This framework aims to provide an easy way to retrieve and cache data files from provided url.

Installation

Available in iOS 9.0 and later.

Run Terminal

 git \"https://github.com/3pillarlabs/iOS-AssetsCaching.git\" \"master\" > Cartfile
hage update --no-use-binaries --platform iOS
Usage
rt AssetCaching
rt UIKit
rt AssetCaching

s ViewController: UIViewController {

@IBOutlet weak var imageView: UIImageView!
let assetManager: AssetManager = AssetManager()

override func viewDidLoad() {
    super.viewDidLoad()

    let urlString = "https://oceanservice.noaa.gov/facts/sealevel-global-local.jpg"
    if let url = URL(string: urlString) {
        if let asset = Asset(networkURL: url) {
            assetManager.fetchAsset(asset, completion: {[weak self] (asset, error) in
                if let url = asset.localURL, let image = UIImage(contentsOfFile: url.path) {
                    //Load the asset inside an image view
                    print(image.debugDescription)
                    self?.imageView.image = image
                }
            })
        }
    }
}

Demo appplication

For a light demonstration check out “DemoApp” branch to observe functionality.

icense

set Caching** is released under MIT license. See [LICENSE](LICENSE) for details.

bout this project

Pillar Global](https://www.3pillarglobal.com/wp-content/themes/base/library/images/logo_3pg.png)](http://www.3pillarglobal.com/)

set Caching** is developed and maintained by [3Pillar Global](http://www.3pillarglobal.com/).

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.