How it works
The Location Tracker app tracks user locations and stores those locations in Cloudant. When you run the Location Track app for the first time register as a new user:
The Location Tracker app tracks users as they move. Blue pins mark each location recorded by the app. A blue line is drawn over the path the user has travelled. Each time the Location Tracker app records a new location a radius-based geo query is performed in Cloudant to find nearby places. The radius is represented by a green circle. Places are displayed as green pins:
The Location Tracker app uses Cloudant Sync for iOS to store locations locally and sync them to Cloudant:
All locations are stored in a local datastore and synced to the server. The Location Tracker app can operate completely offline (locations can only be tracked if device has clear sight to satellites). Places can only be queried while online, but are stored locally for offline usage.
Running with Xcode
Clone the project and change into the project directory:
$ git clone https://github.com/ibm-cds-labs/location-tracker-client-swift.git $ cd location-tracker-client-swift
The Location Tracker app uses Cocoa Pods to manage dependencies. If you don't have Cocoa Pods installed you can install it using gem:
$ sudo gem install cocoapods
Once you have Cocoa Pods install run the pod command:
$ pod install
In Xcode open LocationTracker.xcworkspace (note: Be sure to open the workspace and not the xcode project).
Open the AppConstants.swift file in LocationTracker > LocationTracker. Change the baseUrl to point to your Location Tracker Server running on Bluemix or locally:
static let baseUrl: String = "http://location-tracker-XXX.mybluemix.net"
Click the play button to run the project in the iOS Simulator. Register as a new user as described above, grant the app access to track your location, and configure the debug location to "Freeway Drive":
Licensed under the Apache License, Version 2.0.