Some people may not know, there is a code snippet library build into Xcode. Recently I started to use it more often and figured out that it saves a lot of time while coding.

You can find the snippet library at View > Utilities > Show Code Snippet Library.

There are already some code snippets provided by Apple. But the real power comes with the possibility to add your own. To add a code snippet you select code and drag in onto the code snippet library. Xcode opens a popup which lets you edit your code snippet.

Let's say you type the following line a lot (as I do):

@property (nonatomic, strong)  *

To add this as a code snippet select the code and drag it to the snippet library. Enter in the popup

Title: Property Nonatomic Strong

Plattform: All

Language: Objective-C

Completion Shortcut: propertynonatomicstrong

Completion Scopes: All

and change the snippet to

@property (nonatomic, strong) <#type#> *<#name#>

The <#type#> tells the snippet library that there should be a placeholder. This mean that, after you have included this snippet into your code, you only have to type a tab to jump to the <#type#> to change it to the type you need.

I have put the snippets I use most onto github.