skip to Main Content

As i’ve grown as a developer, I’ve developed my own way of styling and managing my ViewControllers and I was hoping there was a way to change the default ViewController. Being able to customize the default ViewController syntax would save me a considerable amount of time down the road.

Creating a new ViewController:
enter image description here

What i get:
Default ViewController

What i want:
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    After some investigation and with the help of this post, it appears there's two viable options - coordinator patterns & code snippets

    Coordinate Patterns

    Tutorial: Custom Xcode Template

    Although the coordinator pattern is doing exactly what is being asked, it appears to be a fairly lengthy and complicated process when compared to code snippets

    Code Snippet

    Awesome Reference: Xcode Snippets

    By highlighting all of the code that is defined in my default ViewController, right-clicking, and selecting "Create Code Snippet", I was able to define a new snippet which can be accessed by clicking the "+" on the top right corner of Xcode (with focus being on a swift file and not a storyboard file) You can even define Keywords for the autocompletion to work off of.


  2. As I know you need to create a custom Xcode project template. And your customized ViewController file needs to use this custom Xcode project. It is used for some design patterns sample.

    In my opinion if you really use this template again and again worth it creating one otherwise it could be little painful

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search