Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving code snippet library in xcode

How can one save / restore user created code snippets in Xcode?

like image 558
the Reverend Avatar asked Sep 12 '11 14:09

the Reverend


People also ask

Where are Xcode snippets stored?

User's code snippets are saved in '~/Library/Developer/Xcode/UserData/CodeSnippets' in the form of xml documents with 'codesnippet' extension.

How do you store your code snippets?

There are various ways you can store a code snippet, either by keeping it in a GitHub repository or can use a smart code snippet manager, like Codiga's Coding Assistant. Coding Assistant allows you to store and reuse code snippets.

How do I create a snippet in Xcode?

Creating a code snippet is easy. Just select the code that you want to make a snippet and drag it to the code snippet section towards the bottom right of the xcode. A window will appear and there you can rename it and add a description.

What is snippet library?

Code Snippet Library is a public library that contains an extensive searchable collection of snippets in various programming languages: HTML, Javascript, PHP, Terminal, SQL, WordPress, API.


1 Answers

The user generated code snippets are saved in

~/Library/Developer/Xcode/UserData/CodeSnippets

And you can simply pass them around to save and restore them. I recommend giving them a meaningful name instead of the generated one.

I wrote a short explanation about it here, and also started a collection of useful code snippets that can be shared on github. There are still very little snippets there, so any useful snippets you have to share would be great.

like image 53
adamsiton Avatar answered Nov 15 '22 10:11

adamsiton