{"id":23777680,"url":"https://github.com/sharkesm/mvdownloader","last_synced_at":"2026-05-20T05:12:53.002Z","repository":{"id":62447230,"uuid":"193604375","full_name":"Sharkesm/MVDownloader","owner":"Sharkesm","description":"A pure swift library used for downloading images or JSON format files and with caching configuration support","archived":false,"fork":false,"pushed_at":"2019-07-22T11:25:23.000Z","size":309,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T10:32:40.939Z","etag":null,"topics":["cache","image","ios","json","network-library","swift","swift-library","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sharkesm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-25T00:45:41.000Z","updated_at":"2019-09-17T18:21:23.000Z","dependencies_parsed_at":"2022-11-01T23:07:04.160Z","dependency_job_id":null,"html_url":"https://github.com/Sharkesm/MVDownloader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkesm%2FMVDownloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkesm%2FMVDownloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkesm%2FMVDownloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharkesm%2FMVDownloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sharkesm","download_url":"https://codeload.github.com/Sharkesm/MVDownloader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239971689,"owners_count":19727217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","image","ios","json","network-library","swift","swift-library","xcode"],"created_at":"2025-01-01T08:48:17.868Z","updated_at":"2026-05-20T05:12:52.967Z","avatar_url":"https://github.com/Sharkesm.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" \u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Sharkesm/MVDownloader/development/MVDownloaderBanner.png\" title=\"MVDownloader logo\" float=left\u003e\n\u003c/p\u003e\n\n# MVDownloader\n\n[![Build Status](https://img.shields.io/travis/Sharkesm/master.svg?style=flat)](https://travis-ci.org/Sharkesm/MVDownloader)\n[![Pod Version](https://img.shields.io/cocoapods/v/MVDownloader.svg?style=flat)](http://cocoadocs.org/docsets/MVDownloader/)\n[![Pod Platform](https://img.shields.io/cocoapods/p/MVDownloader.svg?style=flat)](http://cocoadocs.org/docsets/MVDownloader/)\n[![Pod License](https://img.shields.io/cocoapods/l/MVDownloader.svg?style=flat)](https://github.com/Sharkesm/MVDownloader/blob/master/LICENSE)\n[![Repo Size](https://img.shields.io/github/repo-size/Sharkesm/MVDownloader.svg)](http://cocoadocs.org/docsets/MVDownloader/)\n\nMVDownloader is a native swift library for making asynchronous remote requests to download images or JSON format files from the web. \n\n## Features \n- [x] Asynchronous image downloading and caching.\n- [x] Supports parallel remote requests and caches URL responses\n- [x] Cancelable downloading and re-using resume data from previous requests\n- [x] Fetching of images from the cache to improve performance and experience\n- [x] Built-in transition animation when setting images\n- [x] Supports image placeholder support\n- [x] Guarantee same URL request won't be fired several times\n- [x] Custom cache control and configuration\n- [x] Guarantee invalid URL won't be fired\n- [x] Guarantee main thread won't be blocked\n- [x] Extends UIImageView and exposes usable methods that support a quick way to download images\n- [x] Multiple resources accessing the same resource will be backed up with the same response\n- [x] Supports decoding of instances of a data type from JSON objects.\n- [x] Uses GRC under the hood \n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n- iOS 10.0+ \n- Xcode 10.0+\n- Swift 5.0+\n\n## Dependencies\n- [UIKit](https://developer.apple.com/documentation/uikit)\n\n## Installation\n\nMVDownloader is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n```ruby \nplatform :ios, '10.0'\nuse_frameworks!\npod 'MVDownloader'\n```\n\n## Usage\n\n### Shared Instance  \nMVDownloader has a shared instance that can be utilised to access all of the exposed API methods.\n```swift\nimport MVDownloader \n\nMVDownloader.shared\n```\nBy default the library will cache all responses from all given URL requests and utilises `NSCache` object to provide in-memory spacing of up to `80 mb`.\n You can still configure a custom `NSCache` object with different storage capacity by initiating `MVDownloader.init(urlCache:_)` with defined cache.  \n\n### Download Image\nDownloading images using the library can be as easy as providing a proper `URL` request to `requestImage(from:_, comepletion:_)` method \nand takes over the process of downloading and converting response data to `MVImage` a type of `UIImage`. \n```swift \nimport MVDownloader \n\nlet url = URL(string:\"https://techcrunch.com/wp-content/uploads/2015/04/codecode.jpg?w=1390\u0026crop=1\")!\n\nMVDownloader.shared.requestImage(from: url) { (mvimage, error) in\n    \n    if let downloadedImage = mvimage {\n       print(\"Downloaded image: \", downloadedImage)\n    }\n    \n}\n```\nAlso, there's another way to download images quickly without the hussle writting longer code blocks of such. Checkout `mv_setImage` example. \n\n### Download Image using `mv_setImage`\nMVDownloader library under the hood it extends `UIImageView` and exposes `mv_setUmage(from:_)` method with intention of downloading images and setting them automatically and apply animation transition. \n\n```swift\nimport MVDownloader\n\nguard let url = URL(string:\"https://techcrunch.com/wp-content/uploads/2015/04/codecode.jpg?w=1390\u0026crop=1\") else {\n    print(\"Given url is invalid\")\n    return \n}\n\nlet imageView = UIImageView()\n\n// Downloads image and sets it automatically \nimageView.mv_setImage(from: url) { (error) in \n  ...\n}  \n```\n\n### Download JSON \nDecoding of instances of a particular type from JSON objects can be smootly executed by utilising `MVDownloader` ~ `requestDecodable(type:_,from:)` method.  \n\n```swift \nimport MVDownloader\n\n/// A type that can convert itself into and out of an external representation.\npublic struct PhotoModel: Codable {\n    var urls: PhotoUrls\n}\n\npublic struct PhotoUrls: Codable {\n    var raw: String\n    var full: String\n    var regular: String\n    var small: String\n    var thumb: String\n}\n\n\nguard let pasteBinUrl =\nURL(string:\"https://images.unsplash.com/photo-1464550883968-cec281c19761?ixlib=rb-0.3.5\u0026q=80\u0026fm=jpg\u0026crop=entropy\u0026w=400\u0026fit=max\u0026s=d5682032c546a3520465f2965cde1cec\") else {\nprint(\"Given url is invalid\")\nreturn \n}\n\n/// By default, below function utilises `JSONDecoder` object to decode instances of a data type from JSON objects.  \n\nMVDownloader.shared.requestDecodable(type: [PhotoModel].self, from: pasteBinUrl) { (data, error) in\n\n    ...\n    // Proceed with data extraction \n    ...\n}\n```\n\n### Normal Remote Request \nAnother benefit for this library is that it's not limited to download JSON and Image only. But you can also still make normal requests to the network. \n```swift \nimport MVDownloader \n\nlet url = URL(string: \"www.google.com\")!\nlet urlRequest = URLRequest(url: url)\n\nMVDownloader.shared.request(urlRequest) { (data, error) in\n    ...\n    // Process response data \n    ...\n}\n```\n\n### Cancel Active Request \nActive remote request can still be cancelled and removed completely from active download task collection list. \n```swift \nimport MVDownloader \n\nlet url = URL(string: \"www.google.com\")!\nlet urlRequest = URLRequest(url: url)\n\nlet downloader = MVDownloader.shared \n\n// Active request on progress \ndownloader.request(urlRequest) { (data, error) in \n    ...\n    // Proceed with data extraction\n    ...\n}\n\n\n// Cancelling active request using there associated `URL` request \nlet requestDidCancel = downloader.cancelRequest(for: url)\n\n// Check if request is successfully cancelled \nif requestDidCancel {\n    ...\n}\n```\n\n## Author\n\nManase Michael, sharkesm@gmail.com\n\n## License\n\nMVDownloader is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkesm%2Fmvdownloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkesm%2Fmvdownloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkesm%2Fmvdownloader/lists"}