Open Source Swift Wrapper For Working With Core Motion

Early last year I mentioned a library that utilizes Core Motion to detect how fast a user is moving to determine if the user is walking, running or in a moving vehicle called SOMotionDetector.

Here’s an open source Swift library that simplifies working with the CoreMotion Framework providing a nice wrapper called MotionKit from Muhammad Haroon Baig.

MotionKit greatly simplifies the gathering of accelerometer, gyroscope, and magnetometer values.

You can gather the values together or separately.

This example from the readme shows how to gather accelerometer values

    var motionKit = MotionKit()

<pre><code>motionKit.getAccelerometerValues(interval: 1.0){
    (x, y, z) in
    //Do whatever you want with the x, y and z values
    println("X: \(x) Y: \(y) Z \(z)")

You can find MotionKit on Github here

You can read more about MotionKit over on Haroon Baig’s blog.

A nice Swift based library for working with Core Motion.

Original article: Open Source Swift Wrapper For Working With Core Motion

©2015 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *