CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

JumpingJacker 0.1.7

JumpingJacker 0.1.7

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Nathan Chan.



  • By
  • Nathan Chan

JumpingJacker

Jumping jack detector for ⌚️ (watchOS)

Requirements

  • watchOS 3.0+
  • Xcode 8.0+

Installation

JumpingJacker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "JumpingJacker"

Example usage

import WatchKit
import Foundation
import JumpingJacker

class InterfaceController: WKInterfaceController {
    var jumpingJacker: JumpingJacker = JumpingJacker(movementSensitivity: .normal)
    var jumpingJackCount: Int = 0

    @IBOutlet var jumpingJackCountLabel: WKInterfaceLabel!

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

        jumpingJacker.delegate = self
        jumpingJacker.start()
    }
}

extension InterfaceController: JumpingJackerDelegate {
    func jumpingJackerDidJumpingJack(_ jumpingJacker: JumpingJacker) {
        jumpingJackCount += 1
        DispatchQueue.main.async {
            self.jumpingJackCountLabel.setText(String(describing: self.jumpingJackCount))
        }
    }

    func jumpingJacker(_ jumpingJacker: JumpingJacker, didFailWith error: Error) {
        print(error.localizedDescription)
    }
}

Author

Nathan Chan, [email protected]

License

JumpingJacker is available under the MIT license. See the LICENSE file for more info.