CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Commercial |
ReleasedLast Release | Jan 2018 |
Maintained by Matt Greenfield.
A machine learning based location and activity recording and detection framework for iOS.
pod 'ArcKit'
// the recording manager singleton
let loco = LocomotionManager.highlander
// decide which Core Motion features to include
loco.recordPedometerEvents = true
loco.recordAccelerometerEvents = true
loco.recordCoreMotionActivityTypeEvents = true
// decide whether to use "sleep mode" to allow for all day recording
loco.useLowPowerSleepModeWhileStationary = true
Note: The above settings are all on by default. The above snippets are unnecessary, and just here
to show you some of the available options.
// start recording
loco.startRecording()
when(loco, does: .locomotionSampleUpdated) { _ in
// the raw CLLocation
print(loco.rawLocation)
// a more usable, de-noised CLLocation
print(loco.filteredLocation)
// a smoothed, simplified, combined location and motion sample
print(loco.locomotionSample())
}
when(loco, does: .movingStateChanged) { _ in
if loco.movingState == .moving {
print("started moving")
}
if loco.movingState == .stationary {
print("stopped moving")
}
}
Note: The above code snippets use SwiftNotes to make
the event observing code easier to read. If you're not using SwiftNotes, your observers should be
written something like this:
let noteCenter = NotificationCenter.default
let queue = OperationQueue.main
// watch for updates
noteCenter.addObserver(forName: .locomotionSampleUpdated, object: loco, queue: queue) { _ in
// do stuff
}
// fetch a geographically relevant classifier
let classifier = ActivityTypeClassifier(coordinate: location.coordinate)
// classify a locomotion sample
let results = classifier.classify(sample)
// get the best match activity type
let bestMatch = results.first
// print the best match type's name ("walking", "car", etc)
print(bestMatch.name)
pod install
in the project folder