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 Objective-C Basics (Retired) Introduction to Objective-C Syntax Overview

Is treehouse doing old way of property allocation?

/* I find it confusing to study old way.. I tested newer Xcode 4.4+ convention following .. (only snippets shown) (c) pradeepkr103 at gmail.com - Mobile Architect at GoMobileFirst:)

  • Not only is this FAR easier to read, it seems to be recommended by Apple too, as fitting into the XCode autorelease pool generation. I seriously think Treehouse should update its tutorial. I give full permission for anyone to use this modded code anyway they see fit :) */ ```// Sphere.h #import <Foundation/Foundation.h> @interface Sphere : NSObject @property float xcenter; @property float ycenter; @property float radius; @end

//Sphere.m #import "Sphere.h" @implementation Sphere @end

// main.c #import <Foundation/Foundation.h> #import "Sphere.h" int main(int argc, const char * argv[]) { @autoreleasepool { Sphere *ball = [[Sphere alloc] init]; ball.radius = 25; ball.xcenter = 0; ball.ycenter = 0; NSLog(@"ball radius %f, center [%f, %f]", ball.radius, ball.xcenter, ball.ycenter); } return 0; }

1 Answer

cant seem to get formatting indented .. tried standard md indents AND backticks .. oh well.