{"id":2498,"url":"https://github.com/LeonardoCardoso/NFDownloadButton","last_synced_at":"2025-08-06T16:31:14.814Z","repository":{"id":45741724,"uuid":"91838593","full_name":"LeonardoCardoso/NFDownloadButton","owner":"LeonardoCardoso","description":"Revamped Download Button. It's kinda a reverse engineering of Netflix's app download button.","archived":false,"fork":false,"pushed_at":"2018-09-29T20:45:33.000Z","size":8454,"stargazers_count":434,"open_issues_count":3,"forks_count":32,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-24T03:31:48.756Z","etag":null,"topics":["animation","button","download","ios","objective-c","swift","ui"],"latest_commit_sha":null,"homepage":"https://leocardz.com/nfdowloadbutton-f576fdf30b40","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/LeonardoCardoso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-05-19T19:23:48.000Z","updated_at":"2024-06-12T11:28:50.000Z","dependencies_parsed_at":"2022-09-01T06:10:10.289Z","dependency_job_id":null,"html_url":"https://github.com/LeonardoCardoso/NFDownloadButton","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeonardoCardoso%2FNFDownloadButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeonardoCardoso%2FNFDownloadButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeonardoCardoso%2FNFDownloadButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeonardoCardoso%2FNFDownloadButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeonardoCardoso","download_url":"https://codeload.github.com/LeonardoCardoso/NFDownloadButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228626659,"owners_count":17948033,"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":["animation","button","download","ios","objective-c","swift","ui"],"created_at":"2024-01-05T20:16:15.224Z","updated_at":"2024-12-09T16:31:00.183Z","avatar_url":"https://github.com/LeonardoCardoso.png","language":"Swift","funding_links":[],"categories":["UI","Libs","Button","Swift","UI and SwiftUI","UI [🔝](#readme)"],"sub_categories":["Button","UI","Other free courses"],"readme":"## NFDownloadButton\n\n| || | |\n|:-:|:-:|:-:|:-:|\n| ![iOS](Images/iOS.gif) | ![watchOS](Images/watchOS.gif) | ![tvOS](Images/tvOS.gif)  | ![macOS](Images/macOS.gif) |\n\n[![Platform](https://img.shields.io/badge/platform-iOS-orange.svg)](https://github.com/LeonardoCardoso/NFDownloadButton#requirements-and-details)\n[![CocoaPods](https://img.shields.io/badge/pod-v0.0.6-red.svg)](https://github.com/LeonardoCardoso/NFDownloadButton#cocoapods)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/LeonardoCardoso/NFDownloadButton#carthage)\n\n\u003e Revamped Download Button\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [License](#license)\n\n## Requirements\n\n- iOS 8.0+\n- Swift 4.2+\n- Xcode 10.0+\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n\u003e CocoaPods 1.1.0+ is required to build NFDownloadButton 0.0.6+.\n\nTo integrate NFDownloadButton into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\nuse_frameworks!\n\npod 'NFDownloadButton', '~\u003e 0.0.6'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate NFDownloadButton into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"LeonardoCardoso/NFDownloadButton\" ~\u003e 0.0.6\n```\n\n### Manually\n\nIf you prefer not to use either of the aforementioned dependency managers, you can integrate NFDownloadButton into your project manually.\n\n## Usage\n\nYou can use a `NFDownloadButton` on [Storyboards](#storyboard) or, if you want to do it programatically, you can create it just like you create a UIButton:\n\n```swift\nlet downloadButton = NFDownloadButton(frame: CGRect(x: 0, y: 0, width: 50, height: 50))\nself.parentView.addSubview(downloadButton)\n```\n\n`NFDownloadButton` has four states:\n\n| State 1: To Download | State 2: Will Download | State 3: Ready to Download | State 4: Downloaded |\n|:-:|:-:|:-:|:-:|\n| ![first](Images/first.gif) | ![second](Images/second.gif) | ![third](Images/third.gif)  | ![fourth](Images/fourth.gif) |\n\nYou can switch between states by just doing as following:\n\n```swift\nself.downloadButton.downloadState = .toDownload || .willDownload || .readyToDownload || .downloaded\n```\n\nWhen the button is in `.readyToDownload` state, the button will wait for your to upload its progress. You can do it like this:\n\n```swift\nself.downloadButton.downloadPercent = 0.5\n```\nWhen this value reaches 1.0, then `downloadState` is automatically changed to `.downloaded`.\n\n### Downloaded by default\n\nYou can select the button as downloaded by default. All states will be overridden by `Downloaded` state and no animation will be performed. To do so, just add `isDownloaded` in its constructor, or set it up whenever you want.\n\n```swift\nNFDownloadButton(frame: CGRect(x: 0, y: 0, width: 50, height: 50), isDownloaded: true)\n```\n```swift\ndownloadButton.isDownloaded = true\n``` \n\n### Style\n\n`NFDownloadButton` has four different styles of devices: `iOS`, `watchOS`, `tvOS`, `macOS`. Thus you can customize your final result. This option is only available on constructor.\n\n```swift\nNFDownloadButton(frame: CGRect(x: 0, y: 0, width: 50, height: 50), isDownloaded: true,\n    style: .iOS)\n```\n| iOS | watchOS | tvOS | macOS |\n|:-:|:-:|:-:|:-:|\n| ![iOS](Images/iOS.png) | ![watchOS](Images/watchOS.png) | ![tvOS](Images/tvOS.png)  | ![macOS](Images/macOS.png) |\n\n### Palette\n\nYou also can customize the colors of the button on its constructor.\n\n```swift\nNFDownloadButton(\n    frame: wrapView.frame,\n    isDownloaded: true,\n    style: .iOS,\n    palette: Palette(\n        initialColor: UIColor?,\n        rippleColor: UIColor?,\n        buttonBackgroundColor: UIColor?,\n        downloadColor: UIColor?,\n        deviceColor: UIColor?\n    )\n)\n```\n\n![palette](Images/palette.png)\n\n### Delegate\n\nYou can watch changes of state by implementing the protocol:\n\n```swift\nprotocol NFDownloadButtonDelegate {\n\n    func stateChanged(button: NFDownloadButton, newState: NFDownloadButtonState)\n\n}\n```\n\n### Storyboard\n\nLast but not least, you can customize `NFDownloadButton` properties right from Interface Builder or Storyboards. \n\n![storyboard](Images/storyboard.png)\n\n## License\n\nNFDownloadButton is released under the MIT license. See [LICENSE](https://github.com/LeonardoCardoso/NFDownloadButton/blob/master/LICENSE) for details.\n\n### Follow me for the latest updates\n\u003ca href=\"https://goo.gl/UC8B8o\"\u003e\u003cimg src=\"https://i.imgur.com/pac7UMq.png/\" width=\"179\" height=\"26\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeonardoCardoso%2FNFDownloadButton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLeonardoCardoso%2FNFDownloadButton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeonardoCardoso%2FNFDownloadButton/lists"}