{"id":2480,"url":"https://github.com/okmr-d/DOFavoriteButton","last_synced_at":"2025-08-06T16:30:52.532Z","repository":{"id":34442969,"uuid":"38377312","full_name":"okmr-d/DOFavoriteButton","owner":"okmr-d","description":"Cute Animated Button written in Swift.","archived":false,"fork":false,"pushed_at":"2022-06-13T14:04:23.000Z","size":69,"stargazers_count":3606,"open_issues_count":34,"forks_count":296,"subscribers_count":61,"default_branch":"master","last_synced_at":"2024-12-09T05:45:39.934Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/okmr-d.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":"2015-07-01T14:58:38.000Z","updated_at":"2024-12-07T03:08:13.000Z","dependencies_parsed_at":"2022-06-28T16:54:46.142Z","dependency_job_id":null,"html_url":"https://github.com/okmr-d/DOFavoriteButton","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okmr-d%2FDOFavoriteButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okmr-d%2FDOFavoriteButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okmr-d%2FDOFavoriteButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okmr-d%2FDOFavoriteButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okmr-d","download_url":"https://codeload.github.com/okmr-d/DOFavoriteButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228841483,"owners_count":17980053,"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":[],"created_at":"2024-01-05T20:16:14.799Z","updated_at":"2024-12-09T16:30:59.809Z","avatar_url":"https://github.com/okmr-d.png","language":"Swift","readme":"# DOFavoriteButton\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/DOFavoriteButton.svg?style=flat)](http://cocoapods.org/pods/DOFavoriteButton)\n[![Platform](https://img.shields.io/cocoapods/p/DOFavoriteButton.svg?style=flat)](http://cocoapods.org/pods/DOFavoriteButton)\n[![License](https://img.shields.io/cocoapods/l/DOFavoriteButton.svg?style=flat)](https://github.com/okmr-d/DOFavoriteButton/blob/master/LICENSE)\n\nCute Animated Button written in Swift.\nIt could be just right for favorite buttons!\n![Demo](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/demo.gif)\n\n## Requirements\n* iOS 7.0+\n* Swift 1.2\n\n## Installation\n#### Carthage\nAdd the following line to your `Cartfile`:\n```\ngithub \"okmr-d/DOFavoriteButton\"\n```\n\n#### CocoaPods\nAdd the following line to your `Podfile`:\n```\npod 'DOFavoriteButton'\n```\n\n#### Manual\nJust drag DOFavoriteButton.swift to your project.\n\n## How to use\n#### 1. Add a flat icon image\n![Flat Icon Image](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/flatIconImage.png)\n\n#### 2. Create a button\n##### ・By coding\n```swift\nlet button = DOFavoriteButton(frame: CGRectMake(0, 0, 44, 44), image: UIImage(named: \"star.png\"))\nself.view.addSubview(button)\n```\n\n##### ・By using Storyboard or XIB\n1. Add Button object and set Custom Class `DOFavoriteButton`  \n![via Storyboard](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/storyboard.png)\n\n2. Connect Outlet  \n![connect outlet](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/connect.png)\n\n#### 3. Add tapped function\n```swift\nbutton.addTarget(self, action: Selector(\"tapped:\"), forControlEvents: .TouchUpInside)\n```\n```swift\nfunc tapped(sender: DOFavoriteButton) {\n    if sender.selected {\n        // deselect\n        sender.deselect()\n    } else {\n        // select with animation\n        sender.select()\n    }\n}\n```\n\n## Customize\nYou can change button color \u0026 animation duration:\n```swift\nbutton.imageColorOff = UIColor.brownColor()\nbutton.imageColorOn = UIColor.redColor()\nbutton.circleColor = UIColor.greenColor()\nbutton.lineColor = UIColor.blueColor()\nbutton.duration = 3.0 // default: 1.0\n```\nResult:  \n![Customize](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/changeColor.gif)\n\n## DEMO\nThere is a demo project added to this repository, so you can see how it works.\n\n## Credit/Inspiration\nDOFavoriteButton was inspired by [Twitter's iOS App](https://itunes.apple.com/us/app/twitter/id333903271).\n\n## License\nThis software is released under the MIT License.\n","funding_links":[],"categories":["UI","Libs","Button","Swift","UI [🔝](#readme)","Content"],"sub_categories":["Button","UI","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokmr-d%2FDOFavoriteButton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokmr-d%2FDOFavoriteButton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokmr-d%2FDOFavoriteButton/lists"}