Codepath

Using Custom Code Snippets

When you find yourself using the same pieces of code over and over again, it is often helpful to create a custom Code Snippet!

Step 1: Create a Custom Code Snippet

  • Select the Code Snippet Library on the bottom of the Utilities Pane.
  • Highlight the code you want to save as a snippet.
  • Drag the highlighted code into the Code Snippet Library.
  • Give your Custom Snippet a Name.
  • Give Your Custom Snippet an easy to remember shortcut.

Create a Custom Code Snippet gif

Step 2: Access a Custom Code Snippet

There are 2 easy ways to access your custom code snippet.

  • Type in the shortcut and let Xcode Auto-Complete the rest.
  • Drag the snippet into your file directly from the Code Snippet Library.

Access a Custom Code Snippet gif

Fork me on GitHub