TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jul 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Nathan Chan.
Jumping jack detector for
JumpingJacker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "JumpingJacker"
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)
}
}
Nathan Chan, [email protected]
JumpingJacker is available under the MIT license. See the LICENSE file for more info.