DPS923 MAP523 Week 10 Notes
Thursday, March 12 - classroom lecture
More work with Core Data this week. And, a brief introduction to location services.
Thursday plan
Thursday, March 12
We will cover these - discuss, show-and-tell, diagram, etc. - in the Thursday class. While some brief notes are included below, be prepared to take your own notes.
Multi-entity data model notes.
Table view editing notes.
Location services introduction
A reminder to learn via the code examples.
Code examples
The course’s GitHub repo has code examples for many topics and techniques. You can download a zip of the code repo, or clone it.
- W10a1Entities
- W10a2TVEdit
- W10a3Location
Summary
Here’s a list of topics that we learned something about this week:
- Our first exposure to a multi-entity data model was the
...Canada
code example. It had a Province
one-to-many relationship with City
.
- We know that the Core Data model editor generates a class for each defined entity. The class includes properties for each attribute, and a method to make a fetch request.
- The model editor is also used to define relationships among entities. Most typical of our work is one-to-many. Both ends must be carefully configured.
- The generated class for a related entity includes methods to add and remove items.
- When working with an entity object that has a collection of related objects of another entity, we must be careful to think about the delete handling. Common sense and the app’s purpose will inform that configuration task.
- In the
...Canada
code example, each “list” view controller had its own fetched results controller (frc).
- There is another way of passing on results - just pass on the property value of the collection.
- The data type of the collection is
Set
, which is not an array. It can, however, easily be transformed into an array.
- Which way you choose will depend on your needs and preferences, and the logic at the time.
- Returning to the fetched results controller (frc) topic, the frc will “monitor… and report on… changes… [to] update the user interface”. Implementing that should be done by using the code in the project template.
- Core Location is the technology that enables a developer to use geographic location data in an app.
- There are many parts to an that uses location services, but its core or base part is the
CLLocationManager
object. That knows how to use the device’s locators, and report the results.
- Using location is a privacy-sensitive task, so the developer must ask the user for consent.
- The location data gathering task is highly configurable, with regard to frequency, accuracy, and so on.
- There is a standard approach to getting location data, which must be used.
- In addition, the hosting controller must conform to the
CLLocationManagerDelegate
, so that events that arise can be handled.
- Reverse geocoding is the name given to the task of converting a GPS coordinate into a street address.
- You should be able to learn at least five new coding tasks and strategies by studying the code examples.