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 iOS Design Patterns Two-Stage Object Creation Test: Two-stage Object Creation

By calling the designated initializer, code the implementation for the asteroid class method.

i need help

asteroid.h
#import <Foundation/Foundation.h>
#import "ColorCircle.h"

@interface asteroid : NSObject

+(ColoredCircle *) asteroid;


@end
asteroid.m

1 Answer

Hi Celine,

I've not done this course so can't talk through the detail of it. It's been three days, so I hope you've got through this already; apologies for the delay in responding.

However, from the what the question is asking, the first part needs the following code in the .h file:

obj-c.h
+(ColoredCircle *) asteroid;

and the following code in the .m file, recalling the properties that were requested in the first part of the challenge:

obj-c.m
+(ColoredCircle*) asteroid {
  ColoredCircle*asteroid = [[ColoredCircle alloc] initWithDiameter: 1.5 andColor: @"grey"];
}

Rightly or wrongly, that get through the challenge compiler although it does seem to lack much of the code you'd expect!

I hope that helps,

Steve.