Hidden method arguments

31 Jan 2011

Objective-C automatically passes two hidden method arguments with ever method call:

  • self - the object that the method is executing inside
  • _cmd - method's message call

Here's an example of using _cmd:

NSLog(@"%@", NSStringFromSelector(_cmd));

What do you think? Let me know by getting in touch on Mastodon or Bluesky.