Get Updates By E-mail 

Article Written By:
Johann Dowa

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)")
    ....
  }
</code></pre>

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments