https://github.com/kenanatmaca/kmotionhelper
İOS CoreMotion Helper Class
https://github.com/kenanatmaca/kmotionhelper
coremotion ios-lib ios-swift pedometer
Last synced: 2 months ago
JSON representation
İOS CoreMotion Helper Class
- Host: GitHub
- URL: https://github.com/kenanatmaca/kmotionhelper
- Owner: KenanAtmaca
- Created: 2017-09-04T20:08:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-04T20:36:48.000Z (about 8 years ago)
- Last Synced: 2025-07-16T02:37:19.656Z (3 months ago)
- Topics: coremotion, ios-lib, ios-swift, pedometer
- Language: Swift
- Size: 1.95 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KMotionHelper
İOS CoreMotion Helper Class

#### Use
```Swift
var helper = KMotionHelper.shared
```
##### Sensor Actions
```Swift
helper.accelerometer { (acceloremeter) in
// Actions
}
helper.gyro { (gyro) in
// Actions
}
helper.magnetometer { (magnometer) in
// Actions
}
helper.motion { (motion) in
// Actions
}
```
##### Pedometer & Activity
```Swift
helper.startPedometer { (pedo) in
self.pedoLabel.text = "\(pedo.numberOfSteps)"
}
helper.startActivity { (acc) in
if acc.stationary {
self.view.backgroundColor = UIColor.lightGray
} else if acc.walking {
self.view.backgroundColor = UIColor.green
}
}
```
##### Helpful functions
```Swift
scale(data:Double) -> CGFloat
rotation(data: CMRotationRate) -> Double
degree(radian:Double) -> Double
magnitude(from attitude: CMAttitude) -> Double
```
- [X] info.plist select Privacy settings motion usage.