iOS tips: Creating custom code snippets in xCode

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

2 min readSep 30, 2017

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.

Creating a code snippet

Now the code snippet is created. Just drag the code snippet from the snippet section to the editor area . Thats it.

Using the code snippet

But if you need to create some code placeholders, you can edit the code snippets you just saved and add the code placeholders. Placeholders should be written like :

let const = <# placeholder_text/code #>

Have a look at the gif below:

Creating snippets with code placeholders

Thats it.!!


If you enjoyed reading this post, please share and give some clapps so others can find it πŸ‘πŸ‘πŸ‘πŸ‘πŸ‘ !!!!

You can follow me on Medium for fresh articles. Also, connect with me on LinkedIn. Also follow my facebook page on swift: iosswiftblogger.

If you have any comment, question, or recommendation, feel free to post them in the comment section below!




iOS and tvOS developer, dreamer, photographer 🀨