Skip to content

CypherPoet/Xcode-Snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Custom Xcode Snippets ✂️

Custom Code Snippets for Xcode.

Xcode gives us the ability to create custom code snippets by highlighting a block of code, right-clicking, and then selecting the Create Code Snippet option.

For each custom snippet that's created, there is a file stored in the following directory:

~/Library/Developer/Xcode/UserData/CodeSnippets/

(The assumption being that ~/Library/Developer/Xcode/ is the path to your Xcode developer directory).

But what if we want to share these snippets across devices? That's where it helps to store them in a git repo 💪.

Simply download the files here, or clone the repo, and copy whichever .codesnippet file you want to use into the directory above.

Getting Started

Quick-Start Example:

cp -r ./snippets/**/*.codesnippet ~/Library/Developer/Xcode/UserData/CodeSnippets/
cp -r ./snippets/**/*.codesnippet ~/Library/Developer/Xcode/UserData/CodeSnippets/

Those files are plain plist documents using a random UUID as a name and having the .codesnippet file extension.

From there, feel free to use this repo as a starting point or reference for your own snippets! ⚡️

Developing

Find all current snippets on your current machine's Xcode:

open ~/Library/Developer/Xcode/UserData/CodeSnippets/

Then copy in any file you want to add to the repo.