Xcode 4 Code Snippets Library
With Xcode 4 Apple introduced very cool stuff, one I love is the Code Snippet Library. As its name suggests, it’s a library with some snippets of code. What’s cool is that you can add your own snippets and define a shortcut to it.
For example when I work with iPhone SDK I often use the
networkActivityIndicatorVisible property of
UIApplication, so I created a snippet with shortcut netwa, which writes for me :
If like me you want to set a placeholder for an argument, you simply write it this way :
[UIApplication sharedApplication].networkActivityIndicatorVisible = <#state#>;
It will automatically create a token field for your argument (like on the last screenshot).
It’s very convenient when you create snippets with several arguments because it allows to switch to them with the tab key.