XCode Code Snippet

Hello friends. In this article, I will talk about how to create a code snippet with XCode. What is a Code Snippet should be mentioned first. It allows Xcode to automatically fill itself when you actually press the Tab key while you are writing code. For example, when you type a for loop and press the Tab key, it automatically prepares everything for you. You just fill the rest. Below are Swift’s Snippets. You can add something new yourself. I will talk about this.


Let’s say I want to add a comment line to a class and mark it. For this, let’s write a snippet where I can write // Mark. To do this, select the line where you will start the var snippet and click right. Create Code Snippet option will appear here. With it, we can create a new snippet.

Then you will see such a screen. On this screen, you need to specify what kind of structure you should create. For example, after I say “// MARK -” here, it will automatically open a section and write it there. This is just a simple example. You can increase your code writing speed by applying this process to the codes you use a lot. For Section Heading to appear, you need to write as follows.

When we want to use it, it appears as follows.

If you have questions, you can reach by e-mail or comment. Good work.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.