{"id":15038920,"url":"https://github.com/nukotsuka/multidegreelikebutton","last_synced_at":"2025-05-15T01:33:31.462Z","repository":{"id":62448089,"uuid":"153869476","full_name":"nukotsuka/MultiDegreeLikeButton","owner":"nukotsuka","description":"MultiDegreeLikeButton  is a \"like button\" which expresses the degree of like by changing the size. The button gradually expands while the user is tapping. And if the button is 3D touched, it immediately expands.","archived":false,"fork":false,"pushed_at":"2018-10-21T08:24:11.000Z","size":412,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-02T15:01:21.383Z","etag":null,"topics":["3dtouch","button-animation","ios","like-button","swift4"],"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/nukotsuka.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":"2018-10-20T04:26:55.000Z","updated_at":"2025-02-21T19:25:57.000Z","dependencies_parsed_at":"2022-11-01T23:17:02.879Z","dependency_job_id":null,"html_url":"https://github.com/nukotsuka/MultiDegreeLikeButton","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukotsuka%2FMultiDegreeLikeButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukotsuka%2FMultiDegreeLikeButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukotsuka%2FMultiDegreeLikeButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukotsuka%2FMultiDegreeLikeButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nukotsuka","download_url":"https://codeload.github.com/nukotsuka/MultiDegreeLikeButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254256647,"owners_count":22040325,"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":["3dtouch","button-animation","ios","like-button","swift4"],"created_at":"2024-09-24T20:40:46.103Z","updated_at":"2025-05-15T01:33:31.131Z","avatar_url":"https://github.com/nukotsuka.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MultiDegreeLikeButton\n\n[![CI Status](https://img.shields.io/travis/nukotsuka/MultiDegreeLikeButton.svg?style=flat)](https://travis-ci.org/nukotsuka/MultiDegreeLikeButton)\n[![Version](https://img.shields.io/cocoapods/v/MultiDegreeLikeButton.svg?style=flat)](https://cocoapods.org/pods/MultiDegreeLikeButton)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/MultiDegreeLikeButton.svg?style=flat)](https://cocoapods.org/pods/MultiDegreeLikeButton)\n[![Platform](https://img.shields.io/cocoapods/p/MultiDegreeLikeButton.svg?style=flat)](https://cocoapods.org/pods/MultiDegreeLikeButton)\n\n**MultiDegreeLikeButton** is a \"like button\" which expresses the degree of like by changing the size.\nThe button gradually expands while the user is tapping. And if the button is 3D touched, it immediately expands.\n\n|Long press|3D touch|\n|-|-|\n|\u003cimg src=\"https://user-images.githubusercontent.com/33661144/47263807-a904f680-d543-11e8-8e9c-228953ece40d.gif\" width=\"300\"\u003e|\u003cimg src=\"https://user-images.githubusercontent.com/33661144/47263815-d5207780-d543-11e8-945b-5a874047b6b3.gif\" width=\"300\"\u003e|\n\n\n## Requirements\n\n- iOS 10.0+\n- Xcode 10.0+\n- Swift 4.0+\n\n## Installation\n\n\n### CocoaPods\nMultiDegreeLikeButton is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'MultiDegreeLikeButton'\n```\n\n### Carthage\n\nIf you’re using [Carthage](https://github.com/Carthage/Carthage), simply add\nMultiDegreeLikeButton to your `Cartfile`:\n\n```\ngithub 'nukotsuka/MultiDegreeLikeButton'\n```\n\n## Usage\n### Basic\n```swift\nlet heartButton = MultiDegreeLikeButton(imageStyle: .heart)\nheartButton.completion = { _, degree in\n    // do something\n}\n\nview.addSubview(heartButton)\n```\n\n### Custom\n```swift\nlet smileButton = MultiDegreeLikeButton(\n    imageStyle: .custom(defaultImage: \"smile_default\", tappedImage: \"smile_tapped\"), \n    size: CGSize(width: 48, height: 48)\n)\n// custom properties\nsmileButton.likeDegree = 10\nsmileButton.durationLongPress = 5.0\nsmileButton.duration3DTouch = 0.5\nsmileButton.durationShrink = 0.5\nsmileButton.delayBeforeShrink = 0.1\nsmileButton.threshold3DTouch = 5.0\nsmileButton.completion = { button, degree in\n    button.isEnabled = false\n    // do something\n}\n\nview.addSubview(smileButton)\n```\n\n**Properties**\n- `isEnabled: Bool`: if this value is false, `completion` is not called, but animation works.\n- `likeDegree: Int`: the degree of like, and this value is used for expanding scale of the button.\n- `durationLongPress: Double`: the duration of expanding animation while tapping the button.\n- `duration3DTouch: Double`: the duration of expanding animation while 3D touching the button.\n- `durationShrink: Double`: the duration of shrinking animation after end of tap.\n- `delayBeforeShrink: Double`: the delay from the end of tap until shrinking starts.\n- `threshold3DTouch: CGFloat`: the threshold at which 3D touch starts.\n- `completionWithLikeDegree: ((MultiDegreeLikeButton, Int) -\u003e Void)?`: the callback function called after tap finishes. `Int` argument indicates the degree of like based on the time the user was tapping, and the range is from 1 to `likeDegree`. \n\n\n## Author\n\nnukotsuka, [@nukotsuka](https://twitter.com/nukotsuka)\n\n## License\n\nMultiDegreeLikeButton 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%2Fnukotsuka%2Fmultidegreelikebutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnukotsuka%2Fmultidegreelikebutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnukotsuka%2Fmultidegreelikebutton/lists"}