Xcode Code Snippets Library is a very useful feature of Xcode that can greatly simplify your app development process and make it easier and even more enjoyable. It already has some useful pre defined code snippets which you can drag and drop into your source code, edit a little bit and you are done.
Xcode Code Snippets library also allows you to create new code snippets. As I work on my different projects I try to take a note of some code snippets that I often use and add them to Xcode Code Snippets library(and to my SwiftDeveloperBlog.com/code-examples page to share them with you :)) and then whenever I need to add an UIAlertController or UIActivityIndicator for example, I do not have to type the code from scratch. I simply look up a code snippet in the library or on my Swift Code Examples page, paste it into my project, edit a little bit and move on.
With a short video tutorial below I would like to share with you a couple of useful tips on how to use Xcode Code Snippets Library. The video tutorial below will cover how to:
- Create and edit code snippet
- Create code snippet auto completion shortcut
- Organize code snippets into code completion scopes
- Make code snippets required to be edited by using <#Code#> tokens. Code snippet tokens are very useful for example when a function parameter value or some other hard coded value in your code must be edited before a code snippet can be used.
Xcode Code Snippets Library Short Video Tutorial
I hope this short video tutorial was of some value to you and if you are looking for some ready to use code snippets, please check out my Swift Code Examples page which I have already mentioned a few times in this blog post :).
Follow me on one of your favourite social networks to learn about new video tutorials and code examples: