 }
 
 
-@objc(MotionKit) public class MotionKit {
+@objc(MotionKit) public class MotionKit :NSObject{
     
     let manager = CMMotionManager()
     var delegate: MotionKitDelegate?

        if manager.deviceMotionAvailable{
            manager.deviceMotionUpdateInterval = interval
            manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
                (data: CMDeviceMotion!, error: NSError!) in
                
                if let isError = error{
                    NSLog("Error: %@", isError)
                }
                valX = data.magneticField.field.x
                valY = data.magneticField.field.y
                valZ = data.magneticField.field.z
                valAccuracy = data.magneticField.accuracy.value
                
                
                if values != nil{
                    values!(x: valX, y: valY, z: valZ, accuracy: valAccuracy)

        var valZ: Double!
        if manager.gyroAvailable{
            manager.gyroUpdateInterval = interval
            manager.startGyroUpdatesToQueue(NSOperationQueue(), withHandler: {
                (data, error) in
                
                if let isError = error{
                    NSLog("Error: %@", isError)
                }
                valX = data!.rotationRate.x
                valY = data!.rotationRate.y
                valZ = data!.rotationRate.z
                
                if values != nil{
                    values!(x: valX, y: valY, z: valZ)
                }
                let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
                self.delegate?.retrieveGyroscopeValues!(valX, y: valY, z: valZ, absoluteValue: absoluteVal)
            })
            
        } else {
            NSLog("The Gyroscope is not available")
