{"id":17689005,"url":"https://github.com/isapozhnik/haptico","last_synced_at":"2025-04-04T10:09:55.604Z","repository":{"id":56426775,"uuid":"123615516","full_name":"iSapozhnik/Haptico","owner":"iSapozhnik","description":"Haptico 📳 - easy to use haptic feedback generator with pattern-play support","archived":false,"fork":false,"pushed_at":"2024-03-16T15:23:19.000Z","size":814,"stargazers_count":486,"open_issues_count":3,"forks_count":31,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-25T05:56:39.565Z","etag":null,"topics":["feedback","haptic","haptics","ios","swift","taptic","taptic-engine","touch"],"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/iSapozhnik.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-03-02T18:28:15.000Z","updated_at":"2024-10-20T13:38:26.000Z","dependencies_parsed_at":"2024-04-21T18:11:37.143Z","dependency_job_id":null,"html_url":"https://github.com/iSapozhnik/Haptico","commit_stats":{"total_commits":45,"total_committers":9,"mean_commits":5.0,"dds":0.6444444444444444,"last_synced_commit":"1a7bd947f1e96243f4a04a532257eb64b0e046e6"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FHaptico","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FHaptico/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FHaptico/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FHaptico/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iSapozhnik","download_url":"https://codeload.github.com/iSapozhnik/Haptico/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"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":["feedback","haptic","haptics","ios","swift","taptic","taptic-engine","touch"],"created_at":"2024-10-24T11:46:10.709Z","updated_at":"2025-04-04T10:09:55.579Z","avatar_url":"https://github.com/iSapozhnik.png","language":"Swift","funding_links":["http://paypal.me/isapozhnik"],"categories":[],"sub_categories":[],"readme":"![](https://github.com/iSapozhnik/Haptico/raw/master/Assets/Haptico.png)\n\n# Haptico\nHaptico is easy to use iOS haptic feedback generator. Besides default haptic feedbacks it can play patterns! Checkout Example project.\n\n[![CI Status](http://img.shields.io/travis/isapozhnik/Haptico.svg?style=flat)](https://travis-ci.org/isapozhnik/Haptico)\n[![Version](https://img.shields.io/cocoapods/v/Haptico.svg?style=flat)](http://cocoapods.org/pods/Haptico)\n[![License](https://img.shields.io/cocoapods/l/Haptico.svg?style=flat)](http://cocoapods.org/pods/Haptico)\n[![Platform](https://img.shields.io/cocoapods/p/Haptico.svg?style=flat)](http://cocoapods.org/pods/Haptico)\n\n# Table of contents\n* [Example](#example)\n* [How to use](#how-to-use)\n\t1. [Generating predefined default feedbacks](#predefined-feedbacks)\n\t2. [Generating impact feedbacks](#impact-feedbacks)\n\t3. [Pattern play](#pattern-play)\n\t4. [UI Extensions](#ui-extensions)\n* [Installation](#installation)\n* [Mentions](#mentions)\n* [Author](#license)\n\n## Example \u003ca name=\"example\"\u003e\u003c/a\u003e\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## How to use \u003ca name=\"how-to-use\"\u003e\u003c/a\u003e\nFirst of all you will need to import Haptico module into your class:\n\n```swift\nimport Haptico\n```\nAlso keep in mind that depending on the device you are using - the feedback might be different. Starting from iPhone 7 all the iPhones are coming with haptic engine. Prior to iPhone 7 Haptico will use standard vibration. Also Pattern play and impacts are not supported on devices prior to iPhone 7 and iOS 10\n\n### 1. Generating predefined default feedbacks. \u003ca name=\"predefined-feedbacks\"\u003e\u003c/a\u003e\nWith Haptico you can generate three default types of haptic notifications:\n\n```swift\npublic enum HapticoNotification {\n    case success\n    case warning\n    case error\n}\n```\n\nHere is small example how can you generate Success, Warning and Error feedbacks:\n\n```swift\n@IBAction func generateSuccess(_ sender: Any) {\n    Haptico.shared().generate(.success)\n}\n@IBAction func generateWarning(_ sender: Any) {\n    Haptico.shared().generate(.warning)\n}\n@IBAction func generateError(_ sender: Any) {\n    Haptico.shared().generate(.error)\n}\n```\n\n### 2. Generating impact feedbacks \u003ca name=\"impact-feedbacks\"\u003e\u003c/a\u003e\nBesides default haptic notifications, Haptico can also generate impact notifications. The library supports three types of impact notifications **(available in iOS10+ and staring from iPhone 7)**:\n\n```swift\npublic enum HapticoImpact {\n    case light\n    case medium\n    case heavy\n}\n```\n\nAnd to use them call:\n\n```\nHaptico.shared().generate(.medium)\n```\nEasy, huh?\n\n### 3. Pattern play \u003ca name=\"pattern-play\"\u003e\u003c/a\u003e\nAnd now something special - **Pattern Play**. Haptico can play patterns, \"coded\" as String. Let's take a look at small example:\n\n```swift \nHaptico.shared().generateFeedbackFromPattern(\"..oO-Oo..\", delay: 0.1)\n```\nEach character in this string represents some specific haptic impact:\n\n* \"O\" (capital \"o\") - heavy impact\n* \"o\" - medium impact\n* \".\" - light impact\n* \"-\" - delay which has duration of 0.1 second\n\n### 4. UI extensions \u003ca name=\"ui-extensions\"\u003e\u003c/a\u003e\nHaptico comes with a couple of UI Extensions: HapticoButton (which is subclass of UIButton) and UIAlertController extension with haptic feedback.\n\nIn order to start using HapticoButton - just set the class name in your Storyboard to HapticoButton. Then with UIControlEvents.touchDown event you will get heavy impact feedback and with UIControlEvents.touchUpInside and UIControlEvents.touchUpOutside you will get light impact feedback.\n\nTo use Haptico together with UIAlertController follow this simple example:\n\n```swift\nfunc showSuccessAlert() {\n    let alert = UIAlertController(title: \"Alert Title\", message: \"Alert Message\", preferredStyle: .alert)\n    alert.addAction(UIAlertAction(title: \"Ok\", style: .default, handler: nil))\n    present(alert, animated: true, hapticNotification: .success)\n}\n```\n\n## Installation \u003ca name=\"installation\"\u003e\u003c/a\u003e\n\nHaptico is available through [CocoaPods](#cocoapods), [Carthage](#carthage) and [Swift Package Manager](#swift-package-manager). \n\n### Cocoapods\nTo install it using [CocoaPods](https://cocoapods.org), simply add the following line to your Podfile:\n\n```ruby\npod 'Haptico'\n```\n\n### Carthage\nTo install it via [Carthage](https://github.com/Carthage/Carthage), add the following line to your Cartfile and follow the instructions to [adding frameworks to an application](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application):\n\n```\ngithub \"iSapozhnik/Haptico\"\n```\n\n### Swift Package Manager\nTo install it using the [Swift Package Manager](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app), either directly add it to your project using Xcode 11, or specify it as dependency in the Package.swift file:\n\n\n```swift\n// ...\ndependencies: [\n    .package(url: \"https://github.com/iSapozhnik/Haptico.git\", from: \"1.1.0\"),\n],\n//...\n```\n\n## Mentions \u003ca name=\"mentions\"\u003e\u003c/a\u003e\n- [Medium](https://medium.com/better-programming/5-ios-libraries-that-will-inspire-your-creativity-26ee5837f9b7)\n\n## Author \u003ca name=\"author\"\u003e\u003c/a\u003e\n\nisapozhnik, sapozhnik.ivan@gmail.com\n\n## Donation\nIf you like this project and it helps you to reduce time to develop, you can give me a cup of ☕️ 😉 \n\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](http://paypal.me/isapozhnik)\n\n## License \u003ca name=\"license\"\u003e\u003c/a\u003e\n\nHaptico 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%2Fisapozhnik%2Fhaptico","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisapozhnik%2Fhaptico","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisapozhnik%2Fhaptico/lists"}