Database Reference
In-Depth Information
The bottom half consist of a chart that shows RAM usage over time. For Employee
Directory, you'll see two distinct areas.
1. Upon first launch, Employee Directory performs an import operation before
loading the primary employee list. Ignore these spikes in memory for now.
2. The next area takes place after the import operation, when the employee list is
visible. Once the app has fully loaded the list, you can see the memory usage is
fairly stable.
Note:
If you use a device besides an iPhone 4S, including the iOS Simulator,
your memory gauge may not look exactly like these screenshots. The
utilization percentages will be based off of the amount of available RAM on
your test device, which may not match the RAM available on an iPhone 4S.
There are only 50 employee records in the app so the RAM usage is quite high. It
could be something in the data model that's using up so much memory for so few
records, so let's start there.
Exploring the data source
In Xcode, open the project navigator and click on
EmployeeDirectory.xcdatamodeld
to view the data model.
The model for the starter project consists of an
Employee
entity with 11 attributes
and a
Sale
entity with two attributes.
On the
Employee
entity, the
about
,
address
,
department
,
email
,
guid
,
name
and
phone
attributes are string types;
active
is a Boolean;
picture
is binary data;
startDate
is
a date and
vacationDays
is an integer.
Employee
has a to-many relationship with
Sale
, which contains an
amount
integer
attribute and a
date
Date attribute.
On first launch, the app will import sample data from the bundled JSON file
seed.json
. Here's an excerpt of the JSON:
{
"guid"
:
"769adb89-82ad-4b39-be41-d02b89de7b94"
,
"active"
:
true
,
"picture"
:
"face10.jpg"
,
"name"
:
"Kasey Mcfarland"
,
"vacationDays"
:
2
,
"department"
:
"Marketing"
,
"startDate"
:
"1979-09-05"
,
"email"
:
"kaseymcfarland@liquicom.com"
,
"phone"
:
"+1 (909) 561-2981"
,
"address"
:
"201 Lancaster Avenue, West Virginia, 2583"
,