@property
is the keyword for declaring a variable in a .hPerson *person1 = [[Person alloc] init];
*
when declaring a new variable, just before the name (for all non-number objects)
(i.e: NSString *myStr = @"Hello"
)-(type)myproperty{...}
_myproperty
will be the property value-(void)setMyproperty:(type)myproperty{...}
myproperty
will be the new value_myproperty
will be the old value@
sign before the string (i.e: @"Test"
)[NSString stringWithFormat: @"My name is %@!", firstName];
)int
, float
or double
but if you need to store numbers in an array you have to use NSNumber
(i.e: NSNumber *myNum = [NSNumbre numberWithInt:8];)
BOOL
typeYES
and NO
as valueif (myBool) {}
instead of if (myBool == YES) {}
if (!myBool) {}
instead of if (myBool == NO) {}
+
attribute instead of -
NSArray
for array initialized with data (you can't modify data)NSMutableArray
for array that should be modifiednil
value)_Nullable
is the equivalent of ?
in Swift_Nonnull
is the equivalent of !
in Swift