Create Xcode file templates and share them with your team

New files that match your preferred coding style

Andrew Lord
Swift Programming

--

Something all Xcode users will be familiar with is the process of creating new files. When the new file command is triggered, we are presented with a window containing a selection of templates to base our new file upon. These new templates often contain lines of code we immediately delete or code that needs to be changed to fit into our preferred style.

Many people may be unaware that instead of relying solely on the provided templates, we can create our own and have Xcode present them to us. This can simplify the process of creating new files and allow them to match more specific requirements.

The process of creating templates can seem a bit confusing at first, but the end result can be really useful. We are going to explore the process of writing our own Xcode file templates, before delving into how we might go about sharing these with other developers on a particular project.

Before we continue: Please check out the article on my blog, Lord Codes, you will find code snippets with themed syntax highlighting and much more, it is definitely my preferred way to read it! 👍

A sheet of paper with pencils, rubber and light bulb sitting on it.
Prepare the template

Creating a template

--

--

Andrew Lord
Swift Programming

Mobile Lead @WorkiroApp . Android and iOS Engineer. Author @ http://lordcodes.com. Avid gamer and music fan.