Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Asterisk

Question One. What is the asterisk for in this code where is says -(SKAction*)? Is it because we are carrying an array ?

 -(SKAction*) tapAction {
 if (_tapAction != nil) {
 return _tapAction;
 }

 NSArray *spaceCatTextures = @[[SKTexture textureWithImageNamed:@"spacecat_2"],
 [SKTexture textureWithImageNamed:@"spacecat_1"]];

 _tapAction = [SKAction animateWithTextures:spaceCatTextures timePerFrame:0.25];

 return _tapAction;
 }

Question Two. Why do I not have to put an Asterisk in the CGPoint variable found in the for in loop ?

 for (UITouch *touch in touches) {
        CGPoint position = [touch locationInNode:self];
        [self shootProjectileAtPosition:position];

3 Answers

Check out Douglas Turner's excellent Objective-C Basics course here on Treehouse (https://teamtreehouse.com/library/objectivec-basics/pointers-and-memory/pointer-power)

He explains it way better than I could in just a few lines in a forum.

Also, Pasan Premaratne and Amit Bijlani have very thorough and well-explained video courses.

All the best with your learning :)

Hi Shaun,

An asterisk in Objective-C indicates a pointer to an object, i-e. an address to where the object is in memory.

CGPoint is not an object, it is a struct and structs do not take pointers.

Hope this helps

Could you describe what an object is ?