Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmsc436PublicF2021
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Keleher
cmsc436PublicF2021
Commits
488b2781
Commit
488b2781
authored
3 years ago
by
Peter J. Keleher
Browse files
Options
Downloads
Patches
Plain Diff
auto
parent
3a4a1342
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assign4/README.md
+91
-0
91 additions, 0 deletions
assign4/README.md
with
91 additions
and
0 deletions
assign4/README.md
0 → 100644
+
91
−
0
View file @
488b2781
# Assignment 4: Documents and a SwiftUI Map
## Goals
Learn to use:
-
SwiftUI Map
-
Core Location
-
Core Data
You will build a biking or running GPS tracker app that saves and displays tracks
by browsing the local core data. We have posted a demo video of the app titled "assign4.mov" on Canvas.
## Tasks
The following is a suggested series of steps for you to take, together
with approximate points that each step will be worth. You can ignore
all this and just emulate the demo video. Doing that gets you
full points. However, the following set of steps is a good approach to
building this app methodically.
## Step 1: Showing a Map (25 pts)
Go through the video on 10/26 for Core Location and using the SwiftUI Map object.
Display the static location of the user on a map. Core data was
discussed 10/14 and 10/19
## Step 2: Tracking the Rider (25 pts)
-
Set up location updating to get location updates.
-
Keep the user centered in the middle of the screen in a region with
an appropriate zoom level. Do this by using the appropriate
`userTrackingMode`
in your
`Map()`
view initialization. This will
make the tracking smooth, not jerky.
## Step 3: Drawing the Path Trajectory (25 pts)
-
At each call of your
`locationManager(manager:, didUpdateLocations:)`
,
you will be given an array of one or more
`CLLocation`
s. Draw the trajectory
of all the points given in this call.
-
In the demo video, we implemented this using annotations. Feel free to use any method
you deem appropriate. You will receive most of the credit as long as the view
indicates the taken path and looks decent. You will get more points if
you are able to use a
`polyline`
overlay over the
`Map`
object.
## Step 4: Saving and Viewing Tracks (25 pts)
Define a core data
`Track`
entity that contains, at a minimum, a name,
a timestamp, and a sequence of coordinates.
You will need to have routines to serialize to and from JSON, which is
cast as a
`Data`
, which is then written/read to/from the database.
## Hints:
-
You can use the simple format specified below to store each track.
```
struct GPXPoint: Codable {
var latitude: Double
var longitude: Double
var altitude: Double
var time: Date
}
struct GPXSegment: Codable {
var coords : [GPXPoint]
}
struct GPXTrack : Codable {
var name : String
var link : String
var time : String
var segments : [GPXSegment] = []
var distance = "-"
var feetClimbed = "-"
}
```
-
The
`Map`
view, like all views, is a
`struct`
. Core location
requires a class instance, so you will have to have a class instancs
that exports location info through bound variables.
-
Make sure you have added the required entry to the Info.plist file. Your app will require entries for accessing location data.
## Notes:
**Important**
: Please avoid the usage of UIKit or any wrappers for UIKit views such as UIViewRepresentable.
Using such packages would result in an automatic 0 in the respective
task. You should
*not*
use
**MKMapView()**
. Instead, use
**Map()**
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment