Use of [] and pointers versus variables


More of an observation than anything else. I was confused about the reasons to use [] rather than not, in particular this was highlighted by the statements:

CGRect tableFrame = CGRectMake(0, 80, 320, 380); ...

It wasn’t obvious to me but apparently there is no (or similar):

CGRect tableFrame = [[CGRect alloc] initWithDimensionsX:0, y:80, width:320, height:380]; ...

because CGRect is a struct not an Objective-C class.

It’s still confusing to me that some variables are pointers to objects and others are equal to values. For example, windowFrame is a variable that contains a struct of type CGRect but theWindow is a pointer to the UIWindow object instance. There is no smiley for ‘brain exploded’… :open_mouth: