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 trialCaleb Kleveter
Treehouse Moderator 37,862 PointsWhat about NSObject?
In this video Amit goes though the different "NS" you might say:
@".."; // NSString @100 // NSNumber @[] // NSArray @{} // NSDictionary
What is NSObject?
2 Answers
Michael Vilabrera
Courses Plus Student 11,252 PointsWe almost never use NSObject in its pure form. It is there to help us allocate and initialize other objects, like arrays/strings/dictionaries.
Caleb Kleveter
Treehouse Moderator 37,862 PointsSo, when do I use NSObject?
Michael Vilabrera
Courses Plus Student 11,252 PointsMichael Vilabrera
Courses Plus Student 11,252 PointsA NSObject is all of these things.
NSObject is pretty much the base of Foundation, which is the means by which we can have strings, numbers, arrays, and dictionaries.
Apple defines it as this: NSObject is the root class of most Objective-C class hierarchies. Through NSObject, objects inherit a basic interface to the runtime system and the ability to behave as Objective-C objects.
To have an NSObject means you can use all these methods on it: +alloc -init -copy -dealloc +new
you can also identify the class using: +class
Of course the amount of things you can do from here are insane, but it is best to get used to building with strings, numbers, arrays, and dictionaries as they will help you understand the later parts that bind them together as NSObject.