I'm trying to better understand some memory management concepts. In order to do so, I need to see the implementation 开发者_C百科of NSDateFormatter:stringFromDate
method. Developer documentation refers to NSDateFormatter.h
, where the method is declared. Following a logical reasoning, I looked for the implementation in it's theoretical counterpart, NSDateFormatter.m
, but I was unable to find that in Finder.
Where can I see that method's implementation?
You can't. The Foundation and UIKit frameworks are not open source. The headers are there so that you can build against the Cocoa libraries, but the implementations are intentionally opaque.
That said, some of the Carbon stuff underlying Foundation on the Mac side is open source, so if you go digging, you might get some idea of how some things work, e.g. http://www.opensource.apple.com/source/CF/CF-550.29/CFDateFormatter.c But this is unlikely to help you if you're just trying to learn about some memory management concepts. In that case, you're better off just asking those questions here on SO about the classes you're interested in.
As quixoto said, the frameworks you are looking for are closed-source. However the GNUstep open-source project aims to reimplement Cocoa, and they have an implementation of NSDateFormatter that you can see. If you are looking to read a lot of internal framework source code, that's one place to start.
精彩评论