Search code examples
cocoaopen-source

Where is the source code for NSObject.m?


I'm trying to find the source for NSObject.m. (I want to compare the pre and post ARC implementations of retain and release.)

I've looked on http://www.opensource.apple.com/ and http://www.macosforge.org/ but not been able to find it.


Solution

  • The source code for Apple's NSObject is contained in the Objective-C runtime package on Apple's open source repository site.

    https://opensource.apple.com/source/objc4/objc4-706/runtime/NSObject.mm

    The whole Objective-C runtime package can be downloaded from https://opensource.apple.com/tarballs/objc4/objc4-706.tar.gz

    Looking back through the previous versions of the runtime package on the site it appears the NSObject.mm file was added in the objc4-532 package.