{"id":19935612,"url":"https://github.com/efremidze/haptica","last_synced_at":"2025-04-12T17:46:25.985Z","repository":{"id":56914427,"uuid":"86864007","full_name":"efremidze/Haptica","owner":"efremidze","description":"Easy Haptic Feedback Generator 📳","archived":false,"fork":false,"pushed_at":"2022-08-28T01:25:50.000Z","size":720,"stargazers_count":782,"open_issues_count":5,"forks_count":45,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-03T20:11:20.761Z","etag":null,"topics":["apple","carthage","cocoapods","feedback","generator","haptic","ios","ios10","notes","patterns","swift","taptic","uibutton","vibrate"],"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/efremidze.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-31T22:09:07.000Z","updated_at":"2025-02-13T03:38:54.000Z","dependencies_parsed_at":"2022-08-21T02:50:57.986Z","dependency_job_id":null,"html_url":"https://github.com/efremidze/Haptica","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efremidze%2FHaptica","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efremidze%2FHaptica/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efremidze%2FHaptica/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efremidze%2FHaptica/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efremidze","download_url":"https://codeload.github.com/efremidze/Haptica/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248609646,"owners_count":21132916,"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":["apple","carthage","cocoapods","feedback","generator","haptic","ios","ios10","notes","patterns","swift","taptic","uibutton","vibrate"],"created_at":"2024-11-12T23:20:57.904Z","updated_at":"2025-04-12T17:46:25.966Z","avatar_url":"https://github.com/efremidze.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Haptica](https://raw.githubusercontent.com/efremidze/Haptica/master/Images/logo.png)\n\n[![Build Status](https://travis-ci.org/efremidze/Haptica.svg?branch=master)](https://travis-ci.org/efremidze/Haptica)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Language](https://img.shields.io/badge/Swift-5-orange.svg?style=flat)](https://swift.org)\n[![Version](https://img.shields.io/cocoapods/v/Haptica.svg?style=flat)](http://cocoapods.org/pods/Haptica)\n[![License](https://img.shields.io/cocoapods/l/Haptica.svg?style=flat)](http://cocoapods.org/pods/Haptica)\n[![Platform](https://img.shields.io/cocoapods/p/Haptica.svg?style=flat)](http://cocoapods.org/pods/Haptica)\n\n**Haptica** is an easy haptic feedback generator.\n\n```\n$ pod try Haptica\n```\n\n## Requirements\n\n- iOS 9.0+\n- Xcode 8.0+\n- Swift 5 (Haptica 3.x), Swift 4 (Haptica 2.x), Swift 3 (Haptica 1.x)\n\n### Haptic Feedback Requirements:\n- A device with a supported Taptic Engine.\n- App is running in the foreground.\n- System Haptics setting is enabled.\n\n## Usage\n\nGenerate using a haptic feedback type.\n\n```swift\nHaptic.impact(.light).generate()\n```\n\n### Feedback Types\n\n* **Impact**: ([UIImpactFeedbackStyle](https://developer.apple.com/reference/uikit/uiimpactfeedbackstyle)) - Use impact feedback generators to indicate that an impact has occurred. For example, you might trigger impact feedback when a user interface object collides with something or snaps into place.\n  * light\n  * medium\n  * heavy\n* **Notification**: ([UINotificationFeedbackType](https://developer.apple.com/reference/uikit/uinotificationfeedbacktype)) - Use notification feedback to communicate that a task or action has succeeded, failed, or produced a warning of some kind.\n  * success\n  * warning\n  * error\n* **Selection** - Use selection feedback to communicate movement through a series of discrete values.\n\n### Vibration Patterns\n\nPlay a custom vibration pattern:\n\n```swift\nHaptic.play(\"..oO-Oo..\", delay: 0.1)\n```\n\nUse pattern symbols to represent custom vibrations.\n- `O` - heavy impact\n- `o` - medium impact\n- `.` - light impact\n- `X` - rigid impact\n- `x` - soft impact\n- `-` - wait 0.1 second\n\nOr play a symphony of notes:\n\n```swift\nHaptic.play([.haptic(.impact(.light)), .haptic(.impact(.heavy)), .wait(0.1), .haptic(.impact(.heavy)), .haptic(.impact(.light))])\n```\n\n### UIButton Extension\n\nTo enable haptic feedback on buttons, set these properties:\n\n- `isHaptic` - enables haptic feedback\n- `hapticType` - haptic feedback type\n\n```swift\nbutton.isHaptic = true\nbutton.hapticType = .impact(.light)\n```\n\nor use these functions to set the haptic feedback type for control events:\n\n- `addHaptic()` - add haptic feedback for control events\n- `removeHaptic()` - remove haptic feedback for control events\n\n```swift\nbutton.addHaptic(.selection, forControlEvents: .touchDown)\nbutton.removeHaptic(forControlEvents: .touchDown)\n```\n\n#### Functions/Properties\n\n```swift\nvar isHaptic: Bool // enables haptic feedback\nvar hapticType: Haptic? // haptic feedback type\nvar hapticControlEvents: UIControl.Event? // haptic feedback control events\nfunc addHaptic(_ haptic: Haptic, forControlEvents events: UIControl.Event) {} // add haptic feedback for control events\nfunc removeHaptic(forControlEvents events: UIControl.Event) {} // remove haptic feedback for control events\n```\n\n### Sound Effects\n\nAdd sound effects to Haptica using [Peep](https://github.com/efremidze/Peep).\n\n```swift\nPeep.play(sound: KeyPress.tap)\n```\n\n## Installation\n\n### CocoaPods\nTo install with [CocoaPods](http://cocoapods.org/), simply add this in your `Podfile`:\n```ruby\nuse_frameworks!\npod \"Haptica\"\n```\n\n### Carthage\nTo install with [Carthage](https://github.com/Carthage/Carthage), simply add this in your `Cartfile`:\n```ruby\ngithub \"efremidze/Haptica\"\n```\n\n## Communication\n\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n## Mentions\n\n- [Fresh Swift](http://freshswift.net/post/-kj8ocn5j9lt_ljpffm4/)\n\n## License\n\nHaptica 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%2Fefremidze%2Fhaptica","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefremidze%2Fhaptica","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefremidze%2Fhaptica/lists"}