If you have used Xcode for any length of time, then you probably used a feature called Code Snippets.
Code Snippets are frequently used blocks of code that you can assign a key combination that'll allow Xcode to automatically type in the code block for you.  You can also backup and share those snippets with other developers.  Unfortunately, this is in a hidden Folder named Library which is apart of the Home Folder.
But first, you have to know where these snippets are stored.
- Open Finder.
- From the above menu, select the "GO" option and then press the [Option] key.
- When the drop down menu appears, there should be a Library option.
- Click it.Â
- The Snippets Folder is in the Library > Developer > Xcode > UserData > CodeSnippets.
- Here's where you can Copy/Paste the Code Snippets Folder to back them up or share them with other Developers.
- That's it.Â
Now that you know where the snippets are stored, lets find out how to use them in Xcode.
- Open Xcode.
- Create a new project OR open an existing project.
- When the project loads, highlight the code you wish to save as a Snippet.
- Right click on the highlighted code.
- A drop down menu appears.
- Find and then select Create Code Snippet....
- A new window opens.
- This window is where you give the snippet a name, description, and assign shortcut combination for the snippet.
- Study the window as it is self-explnatory, except for the bottom.
- At the Completion field, here's where you assign the shortcut for the code. Â This is up to you.
- When finished, click DONE.
Now when ever you type in that shortcut combination and press [ENTER] that code will appear.