In programming, you will inevitably need to use the same functions in different projects. Maybe you have a super-cool sorting algorithm or are just tired of typing out the same stuff for a pickerView.
Enter Code Snippets
In short:
- Type out some code you use all the time
- Select it
- Right click and click on “Create Code Snippet”
- Add in some details like a name and summary
- Click Done
Now, if you need to add in this code to your project, just hit the little plus button in the top right of Xcode (or Shift + Command + L) and drag your code in from the snippets tab.
It’s fast and efficient.
For more, go to: https://sarunw.com/posts/how-to-create-code-snippets-in-xcode/ which explains snippets in awesome detail.