WatchShaker

Experimental Shake Gesture Detection API for Apple Watch

https://github.com/ezefranca/watchshaker

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.1%) to scientific vocabulary

Keywords

apple apple-watch gesture shake-detection swift swift-package-manager watchos
Last synced: 6 months ago · JSON representation ·

Repository

Experimental Shake Gesture Detection API for Apple Watch

Basic Info
Statistics
  • Stars: 240
  • Watchers: 9
  • Forks: 22
  • Open Issues: 2
  • Releases: 11
Topics
apple apple-watch gesture shake-detection swift swift-package-manager watchos
Created about 9 years ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md

WatchShaker

Simple motion detector for ⌚️ (watchOS) shake gesture.

Swift Version Platform github workflow DOI License


WatchShaker is a watchOS helper to get your ⌚️ shake movements

This project was presented at ICECCME 2024. The work is available at IEEE Xplore. You can also find a preprint on Papers with Code.

Requirements

  • watchOS 7.0+
  • Xcode 15.0+

Installation

Swift Package Manager

Once 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.

swift dependencies: [ .package(url: "https://github.com/ezefranca/WatchShaker.git") ]

Manually

  1. Download and drop WatchShaker folder in your project to your watch target.
  2. Congratulations!

Usage example

@StateObject style

```swift import SwiftUI import WatchShaker

struct ContentView: View {

@StateObject var shaker:WatchShaker = WatchShaker(shakeSensibility: .shakeSensibilityNormal, delay: 0.2)

var body: some View {
    VStack {
        if shaker.isShakerAvailable {
            Text("I'm shook! ⌚️⌚️⌚️")
            Text("\(shaker.shake.sensibility)")
            Text("\(shaker.shake.direction)")
        }
    }
}

} ```

Closure Style

```swift import WatchKit import Foundation import WatchShaker

class InterfaceController: WKInterfaceController {

var shaker:WatchShaker = WatchShaker(shakeSensibility: .shakeSensibilityNormal, delay: 0.2)

override func awake(withContext context: Any?) {
    super.awake(withContext: context)
}

override func willActivate() {
    super.willActivate()

    shaker.start()

    shaker.startWatchShakerUpdates = { shakeSensibility, error in

        guard error == nil else
        {
            print(error?.localizedDescription)
            return
        }
        print("I'm shook! ⌚️⌚️⌚️")
    }
}

override func didDeactivate() {
    super.didDeactivate()
    shaker.stop()
}

} ```

Delegate Style

```swift import WatchKit import Foundation

class InterfaceController: WKInterfaceController {

override func awake(withContext context: Any?) {
    super.awake(withContext: context)
    // Configure interface objects here.
}

var shaker:WatchShaker = WatchShaker(shakeSensibility: .shakeSensibilityNormal, delay: 0.2)

override func willActivate() {

    super.willActivate()
    shaker.delegate = self
    shaker.start()
}

override func didDeactivate() {

    super.didDeactivate()
    shaker.stop()

}

}

extension InterfaceController: WatchShakerDelegate { func watchShaker(_ watchShaker: WatchShaker, didShakeWith sensibility: ShakeSensibility) { print("I'm shook! ⌚️⌚️⌚️") }

func watchShaker(_ watchShaker: WatchShaker, didFailWith error: Error) {
    print(error.localizedDescription)
}

} ```

Optional Directions

If you are interested, you can get the direction of the shake in the didShakeWith method.

swift func watchShaker(_ watchShaker: WatchShaker, didShakeWith sensibility: ShakeSensibility, direction: ShakeDirection) { print("I'm shook! ⌚️⌚️⌚️ \(direction)") } ShakeDirection is a simple enum that gives you up, down, left, or right directions. The image below shows how each direction is determined.


This gentleman below, for example, is clearly doing a shake with ShakeDirection.shakeDirectionRight 😂


Contribute

We would love for you to contribute to WatchShaker! Check the LICENSE file for more info.

Meta

Docs: Here

Ezequiel França – @ezefranca and all the awesome Contributors

Distributed under the MIT license. See LICENSE for more information.

Owner

  • Name: Ezequiel Santos
  • Login: ezefranca
  • Kind: user
  • Location: Lisbon, Portugal
  • Company: @miniclip

💼 Mobile Developer @miniclip 📲👾 📚 Phd Student @iade-pt 👨🏻‍💻

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "F. Santos"
  given-names: "Ezequiel"
  orcid: "https://orcid.org/0000-0001-9321-8444"
title: "WatchShaker"
version: 1.0.0
doi: 10.5281/zenodo.5224580
date-released: 2021-08-19
url: "https://github.com/ezefranca/WatchShaker"

GitHub Events

Total
  • Watch event: 7
  • Push event: 1
Last Year
  • Watch event: 7
  • Push event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 82
  • Total Committers: 9
  • Avg Commits per committer: 9.111
  • Development Distribution Score (DDS): 0.195
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Ezequiel Santos e****p@g****m 66
Lorenz So l****o@g****m 3
Gus Verdun g****c@a****m 3
Marko Hlebar m****r@g****m 2
Ezequiel Santos e****s@s****k 2
Ezequiel França e****s@p****r 2
Ezequiel França e****s@b****m 2
Nathan Mak n****k@i****m 1
DigitalDaring 4****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 9
  • Total pull requests: 6
  • Average time to close issues: 8 months
  • Average time to close pull requests: 29 days
  • Total issue authors: 6
  • Total pull request authors: 5
  • Average comments per issue: 1.56
  • Average comments per pull request: 1.17
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ghv (4)
  • ezefranca (1)
  • noahbino (1)
  • lazerwalker (1)
  • vanditmehta (1)
Pull Request Authors
  • markohlebar (2)
  • lorenzhk (1)
  • ghv (1)
  • DigitalDaring (1)
Top Labels
Issue Labels
enhancement (3) bug (2) duplicate (2) invalid (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 4
  • Total maintainers: 1
cocoapods.org: WatchShaker

watchOS shake moviment

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Stargazers count: 5.2%
Forks count: 7.6%
Average: 9.8%
Dependent packages count: 12.2%
Dependent repos count: 14.2%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/swift.yml actions
  • actions/checkout v3 composite
  • muukii/actions-xcode-install-simulator 1.0.0 composite
.example/Shake/Shake.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved swiftpm
  • github.com/ezefranca/WatchShaker
Package.swift swiftpm