My Personal Collection of Code Snippets
My Code Snippet I have to admit I'm a fairly lazy person — I don't want to type the same code a third time, so I automate as much as possible. With that in mind, I've built up a collection of code snippets. Syncing code snippets can be a challenge, but there are two main approaches: 1. Use ACCodeSnippetRepositoryPlugin to manage code snippets. 2. Use for version control and create symbolic links locally. This is the approach I use. Notes: - You can use the script : - The (autocomplete shortcut key) is the most important setting. Once you configure a keyword, typing it in the editor will bring up autocomplete suggestions. Without it, code snippets can only be dragged into the editor. The and are displayed in the autocomplete popup. Specifying a and restricts the snippet to specific contexts. When you drag a snippet to create it, Xcode will automatically infer these based on where you dragged from. - Placeholders in code snippets can be added in the format . - Completion shortcut keys can include a small number of special symbols — known ones include . Other symbols besides , while they can be entered, will cause the shortcut to stop working from that character onward (for example, if the shortcut is , after typing and seeing the suggestion appear, typing will dismiss it). - User-defined code snippets are stored in . - Some shortcut examples: - Complete method autocomplete uses as the prefix. Check them all out after installation. Code: All code from this article can be found on my GitHub at .