Xcode4 introduces user customizable code snippets as a prominent feature in the editor.
How to add a new snippet:
Select the text you wish to create a snippet for
Drag the code to the snippet library
Introduce variables using <# Title #> markup
Save.
From now on I’ll post useful snippets I’m using on this weblog: follow the tag snippet for updates.