Exercises

  1. Add error handling to the code. For example, you could present an alert to the users if they haven’t authorized the use of the device location.

  2. Change the code so the user can “lift” the “pencil” and continue the drawing at another place.

    Hint: Use an array of arrays of CLLocations.

  3. Add a label to the user interface that shows the walked distance.

    Hint: Change the reduce call in addOverlay(with:) to a for loop and sum the distances between consecutive locations.

  4. Make the paths conform to Codable and implement storing and retrieving of previous paths.

    Hint: Search the Internet for Codable. There are many examples online.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.28.48