首页 > > 详细

辅导FIT3178: iOS Application Development

FIT3178: iOS Application Development
Lab 4 – Using Core Data


Lab 4 – Using Core Data

Overview:
The purpose of the lab for this week is twofold. First, this lab demonstrates how to
implement Core Data within our projects. Secondly the lab shows a way to separate
the Database and View Controller layers (we will replace Core Data with Firebase for
the database in Lab 06).

This lab is a continuation of last week’s base solution. Extension tasks are not required.

To work on this week’s lab, you will need to pull the main branch from your Git Repo of
the week 3 lab. This main branch should contain the solution WITHOUT the extension tasks,
as you should have created a branch for the extension tasks last week. See the following
page for instructions.

Assessment note: This lab exercise forms part of your assessment for FIT3178. You should
complete the entire exercise, revise the contained material, and attempt the extension
activity prior to the following week’s lab class. In your Week 4 lab, your demonstrator will
conduct a short interview with you to assess your understanding of this lab’s material and
review your solution to the extension task, as well as giving you feedback. This will be worth
5% of your unit mark. You must attend your allocated Week 4 lab class to receive this mark.

Note: Some of the Macs in the lab may be running Windows and need to be rebooted into
the OS X environment. Restart the Mac and hold down the Option key while it is booting.
You will need to select ‘EFI Boot’ and select OS X to launch the correct operating system.

The Task:
For this lab you will add a Core Data persistent database layer to the app from last
week’s lab. This will require no changes to the UI, only changes in the code. The
summary of changes to be made are as follows:
● Create a Core Data Model
● Create a Database Listener
● Create a Database Protocol
● Create a Core Data Controller Class
● Change the Add Hero Controller to use these
● Change the All Heroes Controller to use these
● Change the Current Party Controller to use these

FIT3178: iOS Application Development
Lab 4 – Using Core Data

If you branched your Lab 03 project and did the extension exercises, you should follow
the steps on this page. Start by opening your Lab 03 project.

1) Go to the Source Control Navigator. It will show your extension branch is active.

2) Right-click on the "main" branch and select "Check Out..." from the menu.

3) Choose "Check Out" in the pop-up dialog.

You can now begin the lab exercise.
3

FIT3178: iOS Application Development
Lab 4 – Using Core Data

The steps are broken down to enable testing at multiple points. This represents our
suggestion for how to implement such features—break them into small manageable
chunks that can be written and tested independently.

Creating the Data Model:
To begin this week, open your solution to Week 3 (If you haven’t finished week 3, we
recommend completing that first, as we will not be providing a solution to be used for
this week).

Begin by right-clicking on the project
folder in the Navigation Explorer and
selecting “New Group”.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!