This app utilizes the iOS CoreMotion
framework for accessing accelerometer data and the CoreLocation
framework for monitoring the user's location in real-time. It displays the following information on the screen:
- Distance Travelled: Calculates the distance the user has moved in the last three minutes.
- Real-time Device Movement Data: Displays accelerometer data in real time.
This app is designed to help visualize movement patterns and user location in real time.
- Real-time Accelerometer Data: Captures and updates device movement data on the screen.
- Location Tracking: Continuously monitors the user's location and calculates the distance travelled.
- Real-time Updates: Provides dynamic on-screen updates every few seconds.
- macOS with Xcode installed (version 13 or later recommended).
- iOS device (recommended for real-time accelerometer and GPS testing, as simulators do not support these features effectively).
- Clone or download the repository to your local machine.
- Open the
.xcodeproj
file in Xcode. - Connect an iOS device to your Mac.
- Set up the app's signing and capabilities:
- Go to the Signing & Capabilities tab in Xcode.
- Add a development team.
- Build and run the app on your device by clicking the Run button in Xcode.
- Grant the app permissions for motion and location tracking when prompted.
The app uses the CoreMotion
framework to collect real-time accelerometer data. The data is processed to calculate and display:
- X, Y, Z-axis movement values.
- The overall motion trend.
The CoreLocation
framework enables location tracking and calculates:
- The total distance travelled by the user within the last three minutes.
- Continuous updates as the user moves.
The app presents all data visually, updating the UI in real-time for:
- Device motion data from the accelerometer.
- Distance metrics calculated from the GPS location.
- ViewController.swift: Contains the logic for managing UI updates and integrating accelerometer and location data.
- LocationManager.swift: Handles location updates and calculates the distance travelled.
- MotionManager.swift: Manages accelerometer data collection using
CoreMotion
.
This app requires the following permissions to function properly:
- Location Services: To calculate the distance travelled.
- Motion & Fitness: To capture real-time device movement data.
Make sure to enable these permissions in the app settings if they are not granted initially.
- Testing on a physical device is mandatory to access accelerometer and location data.
- The distance calculation resets after three minutes for continuous tracking.