Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Horiuchi Yuto
2,372 PointsRefactoring into a Model 2/3
My code is not working. I suspect that structure is wrong. Please tell me what the cause is. Here is my code.
import "Quote.h"
@implementation Quote -(NSArray *) quotes { if (_quotes == nil) { _quotes = [[NSArray alloc] initWithObjects:@"goo", @"choki", @"par", nil]; } return _quotes; } @end
4 Answers

Holger Liesegang
50,595 PointsHi Horiuchi,
There's a great video on the right "Tips for asking questions" that might help you with posting your code on the forum.
Your code looks ok but I think the challenge misses the
- (NSString *) randomQuote {
return @"Some Quote";
}
part.
So the full Quote.m would be:
#import "Quote.h"
@implementation Quote
- (NSArray *) quotes {
if (_quotes == nil) {
_quotes = [[NSArray alloc] initWithObjects:@"goo", @"choki", @"par", nil];
}
return _quotes;
}
- (NSString *) randomQuote {
return @"Some Quote";
}
@end

Horiuchi Yuto
2,372 PointsI can not find "Tips for asking questions" . Where is it ? Is it in "Bonus"?

Holger Liesegang
50,595 PointsDirectly at the right column of this forum section ---->

Horiuchi Yuto
2,372 PointsIt is clear. Thank you very much!