Rutvij Kotecha
Rutvij Kotecha

Reputation: 919

Understanding how predefined methods work

I am a novice in Objective-C and I am trying to understand how pre-defined methods work. I went through the documentation of XCode and the *.h files where the method is defined. However I am eager to read the *.m file or any other document that can help me understand how the method works.

For instance - isEqualToString:(NSString *) checks if two strings (of the type NSString) are equal or not. I am not satisfied with this description. I am eager to see how the method works internally or what is the algorithm it follows. Where can I find this information?

Thank you for your help.

Upvotes: 1

Views: 222

Answers (2)

Tim
Tim

Reputation: 60130

Unfortunately, a lot of the implementation (.m) files for Apple's frameworks aren't provided publicly. You have a couple alternatives:

  1. As Matthias suggested in a comment, use the debugger and inspect the assembler code generated for that method.
  2. Browse through the repositories for the GNUstep project, which has some equivalents to Apple classes.

Upvotes: 1

J2theC
J2theC

Reputation: 4452

  • isEqualToString:(NSString *) is a method defined in the NSString class. Apple provides you with the framework, but they do not provide the implementation of those methods. Therefore, you can't see the source behind the standard framework's libraries.

Edit: you can create a binary and use this app to check the assembly code: http://itunes.apple.com/us/app/hopper-disassembler/id422856039?mt=12

Upvotes: 1

Related Questions