{"id":22642813,"url":"https://github.com/ezefranca/watchshaker","last_synced_at":"2025-04-12T16:39:43.981Z","repository":{"id":53759734,"uuid":"76083447","full_name":"ezefranca/WatchShaker","owner":"ezefranca","description":"Experimental Shake Gesture Detection API for Apple Watch","archived":false,"fork":false,"pushed_at":"2024-12-24T11:15:04.000Z","size":3141,"stargazers_count":235,"open_issues_count":2,"forks_count":22,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-27T16:15:23.833Z","etag":null,"topics":["apple","apple-watch","gesture","shake-detection","swift","swift-package-manager","watchos"],"latest_commit_sha":null,"homepage":"https://cs.paperswithcode.com/paper/experimental-shake-gesture-detection-api-for#code","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/ezefranca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-10T01:40:02.000Z","updated_at":"2025-03-04T21:42:10.000Z","dependencies_parsed_at":"2023-12-07T11:40:34.896Z","dependency_job_id":"81dfd55b-0e66-4440-9856-341f1d7ee529","html_url":"https://github.com/ezefranca/WatchShaker","commit_stats":{"total_commits":68,"total_committers":8,"mean_commits":8.5,"dds":0.5,"last_synced_commit":"f1bed4b31fe66a08585f8d49ee0259ec23dd1319"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezefranca%2FWatchShaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezefranca%2FWatchShaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezefranca%2FWatchShaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezefranca%2FWatchShaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ezefranca","download_url":"https://codeload.github.com/ezefranca/WatchShaker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247043346,"owners_count":20874087,"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","apple-watch","gesture","shake-detection","swift","swift-package-manager","watchos"],"created_at":"2024-12-09T05:08:32.058Z","updated_at":"2025-04-03T17:13:14.241Z","avatar_url":"https://github.com/ezefranca.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# WatchShaker\n\u003e Simple motion detector for ⌚️ (watchOS) shake gesture.\n\n[![Swift Version][swift-image]][swift-url] [![Platform](https://img.shields.io/cocoapods/p/WatchShaker.svg?style=flat)](http://cocoadocs.org/docsets/WatchShaker) ![github workflow](https://github.com/ezefranca/WatchShaker/actions/workflows/swift.yml/badge.svg) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5224580.svg)](https://doi.org/10.5281/zenodo.5224580) [![License][license-image]][license-url]\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/ezefranca/WatchShaker/master/.utils/bwshaker.jpg\" width=\"400\" height=\"300\" /\u003e\n \u003cbr\u003e\n  WatchShaker is a watchOS helper to get your ⌚️ shake movements\n\u003c/p\u003e\n\nThis project was presented at **ICECCME 2024**. The work is available at [IEEE Xplore](https://doi.org/10.1109/iceccme62383.2024.10796862). You can also find a preprint on [Papers with Code](https://cs.paperswithcode.com/paper/experimental-shake-gesture-detection-api-for).\n\n## Requirements\n\n- watchOS 7.0+\n- Xcode 15.0+\n\n## Installation\n\n### Swift Package Manager\n\nOnce you have your Swift package set up, adding WatchShaker as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ezefranca/WatchShaker.git\")\n]\n```\n\n### Manually\n\n1. Download and drop [```WatchShaker```](https://github.com/ezefranca/WatchShaker/tree/main/Sources) folder in your project to your watch target.  \n2. Congratulations!  \n\n## Usage example\n\n### @StateObject style\n\n```swift\nimport SwiftUI\nimport WatchShaker\n\nstruct ContentView: View {\n    \n    @StateObject var shaker:WatchShaker = WatchShaker(shakeSensibility: .shakeSensibilityNormal, delay: 0.2)\n    \n    var body: some View {\n        VStack {\n            if shaker.isShakerAvailable {\n                Text(\"I'm shook! ⌚️⌚️⌚️\")\n                Text(\"\\(shaker.shake.sensibility)\")\n                Text(\"\\(shaker.shake.direction)\")\n            }\n        }\n    }\n}\n```\n\n### Closure Style\n\n```swift\nimport WatchKit\nimport Foundation\nimport WatchShaker\n\nclass InterfaceController: WKInterfaceController {\n    \n    var shaker:WatchShaker = WatchShaker(shakeSensibility: .shakeSensibilityNormal, delay: 0.2)\n    \n    override func awake(withContext context: Any?) {\n        super.awake(withContext: context)\n    }\n    \n    override func willActivate() {\n        super.willActivate()\n        \n        shaker.start()\n        \n        shaker.startWatchShakerUpdates = { shakeSensibility, error in\n            \n            guard error == nil else\n            {\n                print(error?.localizedDescription)\n                return\n            }\n            print(\"I'm shook! ⌚️⌚️⌚️\")\n        }\n    }\n    \n    override func didDeactivate() {\n        super.didDeactivate()\n        shaker.stop()\n    }\n\n}\n```\n\n### Delegate Style\n\n```swift\nimport WatchKit\nimport Foundation\n\nclass InterfaceController: WKInterfaceController {\n\n    override func awake(withContext context: Any?) {\n        super.awake(withContext: context)\n        // Configure interface objects here.\n    }\n\n    var shaker:WatchShaker = WatchShaker(shakeSensibility: .shakeSensibilityNormal, delay: 0.2)\n\n    override func willActivate() {\n\n        super.willActivate()\n        shaker.delegate = self\n        shaker.start()\n    }\n\n    override func didDeactivate() {\n\n        super.didDeactivate()\n        shaker.stop()\n\n    }\n\n}\n\nextension InterfaceController: WatchShakerDelegate\n{\n    func watchShaker(_ watchShaker: WatchShaker, didShakeWith sensibility: ShakeSensibility) {\n        print(\"I'm shook! ⌚️⌚️⌚️\")\n    }\n\n    func watchShaker(_ watchShaker: WatchShaker, didFailWith error: Error) {\n        print(error.localizedDescription)\n    }\n}\n```\n\n### Optional Directions\n\nIf you are interested, you can get the  `direction` of the shake in the `didShakeWith` method. \n\n```swift\nfunc watchShaker(_ watchShaker: WatchShaker, didShakeWith sensibility: ShakeSensibility, \n                     direction: ShakeDirection) {\n    print(\"I'm shook! ⌚️⌚️⌚️ \\(direction)\")\n}\n```\n`ShakeDirection` is a simple enum that gives you `up`, `down`, `left`, or `right` directions. The image below shows how each direction is determined.\n\n\u003cp align=\"center\"\u003e\n\u003cimg class=\"shake\" src=\"https://raw.githubusercontent.com/ezefranca/WatchShaker/master/.utils/apple_watch_directions.png\" width=\"50%\" height=\"50%\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\nThis gentleman below, for example, is clearly doing a shake with `ShakeDirection.shakeDirectionRight` 😂\n\n\u003cp align=\"center\"\u003e\n\u003cimg class=\"shake\" src=\"https://raw.githubusercontent.com/ezefranca/WatchShaker/master/.utils/applewatch.gif\" width=\"50%\" height=\"50%\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n## Contribute\n\nWe would love for you to contribute to **WatchShaker**! Check the ``LICENSE`` file for more info.\n\n## Meta\n\nDocs: [Here](http://ezefranca.com/WatchShaker/docs/documentation/watchshaker/)\n\nEzequiel França – [@ezefranca](https://twitter.com/ezefranca) and all the awesome [Contributors](https://github.com/ezefranca/WatchShaker/graphs/contributors)\n\nDistributed under the MIT license. See ``LICENSE`` for more information.\n\n[swift-url]: https://swift.org/\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg\n[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics\n[codebeat-image]: https://codebeat.co/badges/c19b47ea-2f9d-45df-8458-b2d952fe9dad\n[codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com\n[swift-image]:https://img.shields.io/badge/swift-5.5-orange.svg\n[license-url]: https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezefranca%2Fwatchshaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fezefranca%2Fwatchshaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezefranca%2Fwatchshaker/lists"}