Tuesday, February 14, 2012

How To: Find for a Function/Method That You Did Not Know Existed?

This is a simple but VERY USEFUL tip for new developers who often want to know what other function is available for a particular object. The hard way is to go through Apple's Documentation and read for each Objects.

The easy way is through your XCode code editor. Let me show you how:

Say, you are wondering (or forgetting and trying to remember) what was the code to write variable into the NSUserDefaults (sandbox of your app).

Normally, XCode 4 will automatically pop up the code completion, but if it is not, then you can press ESC button on your keyboard and it will pop it up for you.

Once this is popped up, you can scroll through the valid functions that starts with "set" because we typed that already.

Even if you haven't type anything, just go ahead and press ESC and all possible functions to be input at the cursor point will be popped up for you. 

But surely, the options listed are a whole lot more to choose from. It is a very helpful feature of XCode which every devs should know.

No comments:

Post a Comment