Mobile App Development for iOS
Notes Topics Weekly Resources Graded work Professor Code examplesThursday, February 20 - classroom, Test 2
Monday, March 2 - topic lecture in the computer-lab
Test 2 is TODAY, Thursday, February 20.
Next week is study week, and there are no classes.
When we return on Monday, March 2, we will have a topic lecture in the computer-lab room. Core Data is an important technology in iOS apps, and it will be introduced that day.
What is Core Data? It is an object design, management, and persistence framework.
Thursday, February 20
In the first part of the timeslot, Test 2 will be written. It is worth 12%. It covers all topics covered since the last test.
Here is more and general information about the upcoming test.
Between the Thursday class and the Monday class,
there is a week without classes, study week.
Monday, March 2
Plan for this week:
We will cover these - discuss, show-and-tell, diagram, etc. - in the Monday class. While some brief notes are included below, be prepared to take your own notes too.
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.
What problem are we trying to solve?
Well, recall our work with on-device storage (using JSON files). It worked for our small-scale simple scenarios. For vast amounts of data, it does not scale well. Nor does it offer a rich way to handle complex and interrelated data.
Also, recall our work with web API resources. All data is remote, over a network. If we are offline (i.e. airplane mode), then we don’t have data.
So, the problem - or problems really - that we’re trying to solve include on-device storage, of potentially vast amounts of data, perhaps complex in its organization.
The Core Data technologies offer a solution.
Are there other solutions?
Yes, but coverage is beyond the scope of this course.
It is important, in this academic course, to cover the built-in Apple-provided iOS SDK technologies.
Learning these will enable you to learn others when you need to later in your remaining academic and then professional careers.
Read this document, which is an introduction to Core Data.
Where do we see Core Data in our app? An important component is the stack, which has the code that sets up and configures Core Data for the app. Most of this code is static, and will not need changes or editing.
One of the important objects that gets configured is the context (or more fully, the managed object context). We use the context everywhere in our app (data model manager, controllers).
The data shapes and interrelationships are defined in a Core Data model, which has both a table-driven and graphical way to define and configure our data entities. The Xcode Core Data model editor then generates Swift classes that we can use everywhere in our app.
Data to-and-from the Core Data store is done with fetch request objects. Conceptually, they’re similar to the recently learned web API request objects, in that they enable data service operations (e.g. fetch, add, change, etc.).
Finally, when we’re working with a table view controller, we use a wrapper around a fetch request, known as a fetched results controller. It is purpose-built to work with a table view controller, and offers many benefits.
Use the project template to create a new project and then become familiar with its features.
A new document in the Topics area of this web site has information about the project template.
Another new document in the Topics area of this web site describes how to use the project template.
Incidentally, usage of Core Data in our apps will continue for the rest of this academic course. In other words, it’s not just a topic for the current week.
Here’s a list of topics that we learned something about this week:
TemplateCDv1
(and ...v2
etc.) templates. Use a template as a base for any new app.