Created
August 12, 2010 16:00
-
-
Save nbessi/521200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Xcode 4 custom snippet | |
If you want to make your own custom snippets with in preview version of Xcode 4 and do not want to wait for the function to be implemented here is the way : | |
Open the folder ~/Library/Developer/Xcode/UserData/CodeSnippets | |
Create a file named my_nice_file.codesnippet (one file per snippet) | |
It should look like this : http://gist.github.com/521183 | |
There is only one rule to respect : | |
the value of the key should be unique in all files | |
<key>IDECodeSnippetIdentifier</key> | |
<string>myUniqueValue</string> | |
then you have two choices : | |
-Restart Xcode and edit you custom snippet directly from Xcode. | |
-Edit the file manually | |
If you choose the second choice the first thing to do is to create the content of your snippet inside the IDECodeSnippetContents key : | |
<key>IDECodeSnippetContents</key> | |
<string>class <#MyClass#>(osv.osv): | |
" <#DOCString#>" | |
#_name="My name" | |
_inherit = '<#module.object#>' | |
_description = __doc__ | |
_columns = { | |
} | |
<#MyClass#>()</string> | |
The place holder are define with the following syntax : <#my name#>. | |
Be sure to encode the entities inside the template or you will have a bad surprise. | |
All the other values can be easily deducted from the sample file. | |
My two cents | |
Nicolas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment