Code
With
Chris
Objective
C
Syntax
Reference
and
Glossary
(v1.0)
Class
A
class
is
a
basic
building
block
of
our
app.
It's
a
blueprint
that
describes
the
behavior
and
properties
of
a
component
that
will
be
responsible
for
doing
something
in
our
app.
Classes
are
comprised
of
a
header
(.h):
And
an
interface
file
(.m):
Variable
A
variable
is
used
to
hold
data
or
keep
track
of
an
object
for
later
referencing.
A
local
variable
is
declared
inside
of
a
method
and
will
last
as
long
as
the
method
is
being
executed.
An
instance
variable
is
declared
in
the
private
interface
of
the
.m
file.
Local
Variable
Instance
Variable
Method
A
method
is
a
form
a
communication
between
objects.
Objects
have
methods
which
when
called,
will
execute
the
block
of
code
in
the
method.
An
instance
method
is
called
on
an
object
(an
instance
of
the
class).
A
class
method
can
be
called
on
the
class.
Instance
Method
In
the
.h
file
of
a
class:
In
the
.m
file
of
a
class
Class
Method
In
the
.h
file
of
a
class
In
the
.m
file
of
a
class
Properties
A
property
is
like
an
instance
variable
that
can
be
accessed
by
other
objects.
A
property
is
used
to
store
data
or
keep
track
of
objects.
Declared
in
the
.h
file
of
a
class:
Accessed
in
the
.m
file
using
the
self
keyword:
IF
Statement
An
If
statement
lets
you
test
an
expression
for
true
or
false
and
executes
different
branches
of
code
depending
on
what
conditions
are
met
(or
not
met)
Switch
Statement
A
switch
statement
tests
a
single
int
variable
and
executes
different
branches
of
code
depending
on
what
the
int
is:
For
Loop
A
For
loop
is
a
counted
loop
and
lets
you
execute
a
set
of
code
statements
for
a
number
of
times
until
the
count
is
met
Do
While
Loop
A
Do
While
loop
will
loop
until
a
condition
is
met
but
is
guaranteed
to
go
through
the
loop
at
least
once
before
checking
the
condition.
While
Loop
A
While
loop
will
loop
until
a
condition
is
met
but
will
check
the
condition
at
the
beginning
of
each
loop
including
the
first.
If
the
condition
is
not
met
initially,
then
the
loop
will
not
be
executed.
Array
An
array
is
a
data
structure
used
to
store
lists
of
objects.
It
has
methods
to
add,
insert,
replace
and
access
elements
based
on
index.
A
mutable
array
can
be
altered
after
initialized
whereas
a
regular
array
cannot
be
altered
after
initialization.
NSMutableArray
NSArray
An
array
can
be
accessed
via
index
like
this:
Dictionary
A
dictionary
is
a
data
structure
used
to
store
objects
along
with
an
associated
key
that
is
used
later
to
retrieve
it
from
the
dictionary:
NSMutableDictionary
NSDictionary
An
object
in
a
dictionary
can
be
accessed
by
key
like
this:
Delegation
and
Protocols
Delegation
is
a
way
for
an
object
to
communicate
with
other
objects
without
knowing
anything
about
who
theyre
communicating
with.
For
example,
the
tableview
class
declares
a
protocol,
which
is
a
list
of
methods:
It
also
declares
a
delegate
property
and
it
will
call
the
protocol
methods
on
the
object
this
delegate
property
points
to:
Any
object
wishing
to
handle
communication
with
the
tableview
must
implement
the
protocol
by
declaring
that
it
conforms
to
the
protocol
in
the
.h
file
like
this:
In
the
.m
file,
it
must
implement
the
protocol
methods