iOS tips: Creating custom code snippets in xCode

How to create custom code snippets in xcode? Its super easy.

Abhimuralidharan
2 min readSep 30, 2017
stocksnap.io

Xcode 11 made it easy to create a code snippet. This is how we do it.

Outdated article below (Before xcode 11):

Whenever you find some useful code that you can reuse in xcode, do create a code snippet. Code snippets appear towards the right bottom corner of xcode (under the utilities section).

code snippets

There are so many pre defined code snippets in xcode. You just have to drag the required snippet to your editor area and use it. Sometimes you may have to edit some variable names and all as per your code. Its very much helpful in programming.

How to create a code 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. Check the gif below.

--

--