diff --git a/MotionKit.xcodeproj/project.pbxproj b/MotionKit.xcodeproj/project.pbxproj
index f9980c2..ff639b5 100644
--- a/MotionKit.xcodeproj/project.pbxproj
+++ b/MotionKit.xcodeproj/project.pbxproj
@@ -161,14 +161,16 @@
75FDED4C1A9541F800283A97 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0610;
+ LastUpgradeCheck = 0830;
ORGANIZATIONNAME = MotionKit;
TargetAttributes = {
75FDED541A9541F800283A97 = {
CreatedOnToolsVersion = 6.1.1;
+ LastSwiftMigration = 0830;
};
75FDED5F1A9541F800283A97 = {
CreatedOnToolsVersion = 6.1.1;
+ LastSwiftMigration = 0830;
};
};
};
@@ -248,16 +250,20 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -294,8 +300,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -304,6 +312,7 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -313,6 +322,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
@@ -323,6 +333,7 @@
75FDED6C1A9541F800283A97 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -330,14 +341,17 @@
INFOPLIST_FILE = MotionKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.motionkit.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
+ SWIFT_VERSION = 3.0;
};
name = Debug;
};
75FDED6D1A9541F800283A97 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -345,8 +359,10 @@
INFOPLIST_FILE = MotionKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.motionkit.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
+ SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -363,7 +379,9 @@
);
INFOPLIST_FILE = MotionKitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.motionkit.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -376,7 +394,9 @@
);
INFOPLIST_FILE = MotionKitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.motionkit.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -399,6 +419,7 @@
75FDED6D1A9541F800283A97 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
75FDED6E1A9541F800283A97 /* Build configuration list for PBXNativeTarget "MotionKitTests" */ = {
isa = XCConfigurationList;
@@ -407,6 +428,7 @@
75FDED701A9541F800283A97 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
diff --git a/MotionKit.xcodeproj/project.xcworkspace/xcuserdata/nicholasarner.xcuserdatad/UserInterfaceState.xcuserstate b/MotionKit.xcodeproj/project.xcworkspace/xcuserdata/nicholasarner.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..27cc100
Binary files /dev/null and b/MotionKit.xcodeproj/project.xcworkspace/xcuserdata/nicholasarner.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/MotionKit.xcodeproj/xcuserdata/nicholasarner.xcuserdatad/xcschemes/MotionKit.xcscheme b/MotionKit.xcodeproj/xcuserdata/nicholasarner.xcuserdatad/xcschemes/MotionKit.xcscheme
new file mode 100644
index 0000000..3799fd0
--- /dev/null
+++ b/MotionKit.xcodeproj/xcuserdata/nicholasarner.xcuserdatad/xcschemes/MotionKit.xcscheme
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MotionKit.xcodeproj/xcuserdata/nicholasarner.xcuserdatad/xcschemes/xcschememanagement.plist b/MotionKit.xcodeproj/xcuserdata/nicholasarner.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..d78602b
--- /dev/null
+++ b/MotionKit.xcodeproj/xcuserdata/nicholasarner.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+
+
+
+
+ SchemeUserState
+
+ MotionKit.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ 75FDED541A9541F800283A97
+
+ primary
+
+
+ 75FDED5F1A9541F800283A97
+
+ primary
+
+
+
+
+
diff --git a/MotionKit/Info.plist b/MotionKit/Info.plist
index c328732..d3de8ee 100644
--- a/MotionKit/Info.plist
+++ b/MotionKit/Info.plist
@@ -7,7 +7,7 @@
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
- com.motionkit.$(PRODUCT_NAME:rfc1034identifier)
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/MotionKit/MotionKit.swift b/MotionKit/MotionKit.swift
index eb0860c..f596111 100644
--- a/MotionKit/MotionKit.swift
+++ b/MotionKit/MotionKit.swift
@@ -15,20 +15,20 @@ import CoreMotion
//_______________________________________________________________________________________________________________
// this helps retrieve values from the sensors.
@objc protocol MotionKitDelegate {
- optional func retrieveAccelerometerValues (x: Double, y:Double, z:Double, absoluteValue: Double)
- optional func retrieveGyroscopeValues (x: Double, y:Double, z:Double, absoluteValue: Double)
- optional func retrieveDeviceMotionObject (deviceMotion: CMDeviceMotion)
- optional func retrieveMagnetometerValues (x: Double, y:Double, z:Double, absoluteValue: Double)
-
- optional func getAccelerationValFromDeviceMotion (x: Double, y:Double, z:Double)
- optional func getGravityAccelerationValFromDeviceMotion (x: Double, y:Double, z:Double)
- optional func getRotationRateFromDeviceMotion (x: Double, y:Double, z:Double)
- optional func getMagneticFieldFromDeviceMotion (x: Double, y:Double, z:Double)
- optional func getAttitudeFromDeviceMotion (attitude: CMAttitude)
+ @objc optional func retrieveAccelerometerValues (_ x: Double, y:Double, z:Double, absoluteValue: Double)
+ @objc optional func retrieveGyroscopeValues (_ x: Double, y:Double, z:Double, absoluteValue: Double)
+ @objc optional func retrieveDeviceMotionObject (_ deviceMotion: CMDeviceMotion)
+ @objc optional func retrieveMagnetometerValues (_ x: Double, y:Double, z:Double, absoluteValue: Double)
+
+ @objc optional func getAccelerationValFromDeviceMotion (_ x: Double, y:Double, z:Double)
+ @objc optional func getGravityAccelerationValFromDeviceMotion (_ x: Double, y:Double, z:Double)
+ @objc optional func getRotationRateFromDeviceMotion (_ x: Double, y:Double, z:Double)
+ @objc optional func getMagneticFieldFromDeviceMotion (_ x: Double, y:Double, z:Double)
+ @objc optional func getAttitudeFromDeviceMotion (_ attitude: CMAttitude)
}
-@objc(MotionKit) public class MotionKit :NSObject{
+@objc(MotionKit) open class MotionKit :NSObject{
let manager = CMMotionManager()
var delegate: MotionKitDelegate?
@@ -52,24 +52,24 @@ import CoreMotion
* given NSOperationQueue will be cancelled. You can access the retrieved values either by a
* Trailing Closure or through a Delgate.
*/
- public func getAccelerometerValues (interval: NSTimeInterval = 0.1, values: ((x: Double, y: Double, z: Double) -> ())? ){
+ open func getAccelerometerValues (_ interval: TimeInterval = 0.1, values: ((_ x: Double, _ y: Double, _ z: Double) -> ())? ){
var valX: Double!
var valY: Double!
var valZ: Double!
- if manager.accelerometerAvailable {
+ if manager.isAccelerometerAvailable {
manager.accelerometerUpdateInterval = interval
- manager.startAccelerometerUpdatesToQueue(NSOperationQueue(), withHandler: {
+ manager.startAccelerometerUpdates(to: OperationQueue(), withHandler: {
(data, error) in
if let isError = error {
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.acceleration.x
valY = data!.acceleration.y
valZ = data!.acceleration.z
if values != nil{
- values!(x: valX,y: valY,z: valZ)
+ values!(valX,valY,valZ)
}
let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
self.delegate?.retrieveAccelerometerValues!(valX, y: valY, z: valZ, absoluteValue: absoluteVal)
@@ -88,25 +88,25 @@ import CoreMotion
* given NSOperationQueue will be cancelled. You can access the retrieved values either by a
* Trailing Closure or through a Delegate.
*/
- public func getGyroValues (interval: NSTimeInterval = 0.1, values: ((x: Double, y: Double, z:Double) -> ())? ) {
+ open func getGyroValues (_ interval: TimeInterval = 0.1, values: ((_ x: Double, _ y: Double, _ z:Double) -> ())? ) {
var valX: Double!
var valY: Double!
var valZ: Double!
- if manager.gyroAvailable{
+ if manager.isGyroAvailable{
manager.gyroUpdateInterval = interval
- manager.startGyroUpdatesToQueue(NSOperationQueue(), withHandler: {
+ manager.startGyroUpdates(to: OperationQueue(), withHandler: {
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.rotationRate.x
valY = data!.rotationRate.y
valZ = data!.rotationRate.z
if values != nil{
- values!(x: valX, y: valY, z: valZ)
+ values!(valX, valY, valZ)
}
let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
self.delegate?.retrieveGyroscopeValues!(valX, y: valY, z: valZ, absoluteValue: absoluteVal)
@@ -124,26 +124,26 @@ import CoreMotion
* Starts magnetometer updates, providing data to the given handler through the given queue.
* You can access the retrieved values either by a Trailing Closure or through a Delegate.
*/
- @available(iOS, introduced=5.0)
- public func getMagnetometerValues (interval: NSTimeInterval = 0.1, values: ((x: Double, y:Double, z:Double) -> ())? ){
+ @available(iOS, introduced: 5.0)
+ open func getMagnetometerValues (_ interval: TimeInterval = 0.1, values: ((_ x: Double, _ y:Double, _ z:Double) -> ())? ){
var valX: Double!
var valY: Double!
var valZ: Double!
- if manager.magnetometerAvailable {
+ if manager.isMagnetometerAvailable {
manager.magnetometerUpdateInterval = interval
- manager.startMagnetometerUpdatesToQueue(NSOperationQueue()){
+ manager.startMagnetometerUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.magneticField.x
valY = data!.magneticField.y
valZ = data!.magneticField.z
if values != nil{
- values!(x: valX, y: valY, z: valZ)
+ values!(valX, valY, valZ)
}
let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
self.delegate?.retrieveMagnetometerValues!(valX, y: valY, z: valZ, absoluteValue: absoluteVal)
@@ -165,18 +165,18 @@ import CoreMotion
* attitudeReferenceFrame to determine this. You can access the retrieved values either by a
* Trailing Closure or through a Delegate.
*/
- public func getDeviceMotionObject (interval: NSTimeInterval = 0.1, values: ((deviceMotion: CMDeviceMotion) -> ())? ) {
+ open func getDeviceMotionObject (_ interval: TimeInterval = 0.1, values: ((_ deviceMotion: CMDeviceMotion) -> ())? ) {
- if manager.deviceMotionAvailable{
+ if manager.isDeviceMotionAvailable{
manager.deviceMotionUpdateInterval = interval
- manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
+ manager.startDeviceMotionUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
if values != nil{
- values!(deviceMotion: data!)
+ values!(data!)
}
self.delegate?.retrieveDeviceMotionObject!(data!)
}
@@ -191,25 +191,25 @@ import CoreMotion
* getAccelerationFromDeviceMotion:interval:values:
* You can retrieve the processed user accelaration data from the device motion from this method.
*/
- public func getAccelerationFromDeviceMotion (interval: NSTimeInterval = 0.1, values: ((x:Double, y:Double, z:Double) -> ())? ) {
+ open func getAccelerationFromDeviceMotion (_ interval: TimeInterval = 0.1, values: ((_ x:Double, _ y:Double, _ z:Double) -> ())? ) {
var valX: Double!
var valY: Double!
var valZ: Double!
- if manager.deviceMotionAvailable{
+ if manager.isDeviceMotionAvailable{
manager.deviceMotionUpdateInterval = interval
- manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
+ manager.startDeviceMotionUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.userAcceleration.x
valY = data!.userAcceleration.y
valZ = data!.userAcceleration.z
if values != nil{
- values!(x: valX, y: valY, z: valZ)
+ values!(valX, valY, valZ)
}
self.delegate?.getAccelerationValFromDeviceMotion!(valX, y: valY, z: valZ)
@@ -225,25 +225,25 @@ import CoreMotion
* You can retrieve the processed gravitational accelaration data from the device motion from this
* method.
*/
- public func getGravityAccelerationFromDeviceMotion (interval: NSTimeInterval = 0.1, values: ((x:Double, y:Double, z:Double) -> ())? ) {
+ open func getGravityAccelerationFromDeviceMotion (_ interval: TimeInterval = 0.1, values: ((_ x:Double, _ y:Double, _ z:Double) -> ())? ) {
var valX: Double!
var valY: Double!
var valZ: Double!
- if manager.deviceMotionAvailable{
+ if manager.isDeviceMotionAvailable{
manager.deviceMotionUpdateInterval = interval
- manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
+ manager.startDeviceMotionUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.gravity.x
valY = data!.gravity.y
valZ = data!.gravity.z
if values != nil{
- values!(x: valX, y: valY, z: valZ)
+ values!(valX, valY, valZ)
}
let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
@@ -261,18 +261,18 @@ import CoreMotion
* You can retrieve the processed attitude data from the device motion from this
* method.
*/
- public func getAttitudeFromDeviceMotion (interval: NSTimeInterval = 0.1, values: ((attitude: CMAttitude) -> ())? ) {
+ open func getAttitudeFromDeviceMotion (_ interval: TimeInterval = 0.1, values: ((_ attitude: CMAttitude) -> ())? ) {
- if manager.deviceMotionAvailable{
+ if manager.isDeviceMotionAvailable{
manager.deviceMotionUpdateInterval = interval
- manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
+ manager.startDeviceMotionUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
if values != nil{
- values!(attitude: data!.attitude)
+ values!(data!.attitude)
}
self.delegate?.getAttitudeFromDeviceMotion!(data!.attitude)
@@ -288,25 +288,25 @@ import CoreMotion
* You can retrieve the processed rotation data from the device motion from this
* method.
*/
- public func getRotationRateFromDeviceMotion (interval: NSTimeInterval = 0.1, values: ((x:Double, y:Double, z:Double) -> ())? ) {
+ open func getRotationRateFromDeviceMotion (_ interval: TimeInterval = 0.1, values: ((_ x:Double, _ y:Double, _ z:Double) -> ())? ) {
var valX: Double!
var valY: Double!
var valZ: Double!
- if manager.deviceMotionAvailable{
+ if manager.isDeviceMotionAvailable{
manager.deviceMotionUpdateInterval = interval
- manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
+ manager.startDeviceMotionUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.rotationRate.x
valY = data!.rotationRate.y
valZ = data!.rotationRate.z
if values != nil{
- values!(x: valX, y: valY, z: valZ)
+ values!(valX, valY, valZ)
}
let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
@@ -324,19 +324,19 @@ import CoreMotion
* You can retrieve the processed magnetic field data from the device motion from this
* method.
*/
- public func getMagneticFieldFromDeviceMotion (interval: NSTimeInterval = 0.1, values: ((x:Double, y:Double, z:Double, accuracy: Int32) -> ())? ) {
+ open func getMagneticFieldFromDeviceMotion (_ interval: TimeInterval = 0.1, values: ((_ x:Double, _ y:Double, _ z:Double, _ accuracy: Int32) -> ())? ) {
var valX: Double!
var valY: Double!
var valZ: Double!
var valAccuracy: Int32!
- if manager.deviceMotionAvailable{
+ if manager.isDeviceMotionAvailable{
manager.deviceMotionUpdateInterval = interval
- manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
+ manager.startDeviceMotionUpdates(to: OperationQueue()){
(data, error) in
if let isError = error{
- NSLog("Error: %@", isError)
+ print("Error: %@", isError)
}
valX = data!.magneticField.field.x
valY = data!.magneticField.field.y
@@ -344,7 +344,7 @@ import CoreMotion
valAccuracy = data!.magneticField.accuracy.rawValue
if values != nil{
- values!(x: valX, y: valY, z: valZ, accuracy: valAccuracy)
+ values!(valX, valY, valZ, valAccuracy)
}
self.delegate?.getMagneticFieldFromDeviceMotion!(valX, y: valY, z: valZ)
@@ -365,38 +365,38 @@ import CoreMotion
/* MARK :- INSTANTANIOUS METHODS START HERE */
- public func getAccelerationAtCurrentInstant (values: (x:Double, y:Double, z:Double) -> ()){
+ open func getAccelerationAtCurrentInstant (_ values: @escaping (_ x:Double, _ y:Double, _ z:Double) -> ()){
self.getAccelerationFromDeviceMotion(0.5) { (x, y, z) -> () in
- values(x: x,y: y,z: z)
+ values(x,y,z)
self.stopDeviceMotionUpdates()
}
}
- public func getGravitationalAccelerationAtCurrentInstant (values: (x:Double, y:Double, z:Double) -> ()){
+ open func getGravitationalAccelerationAtCurrentInstant (_ values: @escaping (_ x:Double, _ y:Double, _ z:Double) -> ()){
self.getGravityAccelerationFromDeviceMotion(0.5) { (x, y, z) -> () in
- values(x: x,y: y,z: z)
+ values(x,y,z)
self.stopDeviceMotionUpdates()
}
}
- public func getAttitudeAtCurrentInstant (values: (attitude: CMAttitude) -> ()){
+ open func getAttitudeAtCurrentInstant (_ values: @escaping (_ attitude: CMAttitude) -> ()){
self.getAttitudeFromDeviceMotion(0.5) { (attitude) -> () in
- values(attitude: attitude)
+ values(attitude)
self.stopDeviceMotionUpdates()
}
}
- public func getMageticFieldAtCurrentInstant (values: (x:Double, y:Double, z:Double) -> ()){
+ open func getMageticFieldAtCurrentInstant (_ values: @escaping (_ x:Double, _ y:Double, _ z:Double) -> ()){
self.getMagneticFieldFromDeviceMotion(0.5) { (x, y, z, accuracy) -> () in
- values(x: x,y: y,z: z)
+ values(x,y,z)
self.stopDeviceMotionUpdates()
}
}
- public func getGyroValuesAtCurrentInstant (values: (x:Double, y:Double, z:Double) -> ()){
+ open func getGyroValuesAtCurrentInstant (_ values: @escaping (_ x:Double, _ y:Double, _ z:Double) -> ()){
self.getRotationRateFromDeviceMotion(0.5) { (x, y, z) -> () in
- values(x: x,y: y,z: z)
+ values(x,y,z)
self.stopDeviceMotionUpdates()
}
}
@@ -411,7 +411,7 @@ import CoreMotion
* Discussion:
* Stop accelerometer updates.
*/
- public func stopAccelerometerUpdates(){
+ open func stopAccelerometerUpdates(){
self.manager.stopAccelerometerUpdates()
NSLog("Accelaration Updates Status - Stopped")
}
@@ -422,7 +422,7 @@ import CoreMotion
* Discussion:
* Stops gyro updates.
*/
- public func stopGyroUpdates(){
+ open func stopGyroUpdates(){
self.manager.stopGyroUpdates()
NSLog("Gyroscope Updates Status - Stopped")
}
@@ -433,7 +433,7 @@ import CoreMotion
* Discussion:
* Stops device motion updates.
*/
- public func stopDeviceMotionUpdates() {
+ open func stopDeviceMotionUpdates() {
self.manager.stopDeviceMotionUpdates()
NSLog("Device Motion Updates Status - Stopped")
}
@@ -444,8 +444,8 @@ import CoreMotion
* Discussion:
* Stops magnetometer updates.
*/
- @available(iOS, introduced=5.0)
- public func stopmagnetometerUpdates() {
+ @available(iOS, introduced: 5.0)
+ open func stopmagnetometerUpdates() {
self.manager.stopMagnetometerUpdates()
NSLog("Magnetometer Updates Status - Stopped")
}
diff --git a/MotionKitTests/Info.plist b/MotionKitTests/Info.plist
index 0e76198..ba72822 100644
--- a/MotionKitTests/Info.plist
+++ b/MotionKitTests/Info.plist
@@ -7,7 +7,7 @@
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
- com.motionkit.$(PRODUCT_NAME:rfc1034identifier)
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/MotionKitTests/MotionKitTests.swift b/MotionKitTests/MotionKitTests.swift
index d78e1e7..0d36021 100644
--- a/MotionKitTests/MotionKitTests.swift
+++ b/MotionKitTests/MotionKitTests.swift
@@ -28,7 +28,7 @@ class MotionKitTests: XCTestCase {
func testPerformanceExample() {
// This is an example of a performance test case.
- self.measureBlock() {
+ self.measure() {
// Put the code you want to measure the time of here.
}
}