After you enter dowhile in Xcode and press enter, Xcode displays the following code:
Xcode4 was introduced. The location in Xcode is shown in:
There are many Xcode code snippets. In the above example, dowhile is one of them.
2. How to customize code snippets because of the differences between projects, languages used, and coding habits, different codes used in different habits are also different. This gives rise to the need to customize code snippets, fortunately, Xcode supports this function. @ Property attribute definition is a common feature in Cocoa program development. The following example shows how to customize code snippets. 1. Write the code snippet and write the following statement where the @ property attribute is declared:
 
@property (nonatomic, retain) <#type#> <#name#>;
Here <# type #> and <# name #> can be seen in the following usage results. 
2. Select the preceding statement when creating a new code snippet, and drag the code snippet to the area in Xcode with the left mouse click to create a new code snippet. 3. After editing the code snippet, go through step 2, when you release the left mouse button, the code snippet editing window is displayed, as shown in: 
The top-to-bottom meaning in the figure is: ① Title of the Title code segment ② description of the Summary code segment ③ Platform can use the Platform of the code segment, there are three options for IOS/OS X/All. ④ Language: in which languages can this code snippet be used? ⑤ Completion Shortcut: The Shortcut of the code snippet. For example, dowhile used at the beginning of this article, here, set the shortcut of attribute settings to property 6 Completion Scopes. In which files can the current code segment be used, for example, all locations and header files are moderate. Of course, multiple supported locations can be added. The last blank area is a preview of the code snippet. After all the settings are complete, click the Done button in the lower-right corner of the menu to complete the creation. 
3. You can use custom code snippets in two ways, or use the newly defined @ property code snippet as an example: 1. In the appropriate location (because when defining code snippets, you can set the platform, language, file usage, and other restrictions ), enter property2 and find the one we just defined in the code snippet. Drag the code snippet with the left mouse button to a proper position and use either of the above two methods, you can see the following results: 
Here, you have noticed the functions of <# type #> and <# name #> written when defining code snippets! The code snippets in Xcode are stored in the following directory by default: 
~/Library/Developer/Xcode/UserData/CodeSnippets 
We can back up the code snippets in the directory or copy them directly to different computers. Therefore, collaboration between multiple computers is not under pressure.