Find helpful iOS and Swift Code Snippets
XCSnippetsApp is the staging area to boost your productivity in Xcode
Xcode code snippets can increase your productivity by quickly producing often-needed boilerplate code. Here is an example of how to create an Error
enum conforming to LocalizedError
with the help of a custom code snippet.
If you are unfamiliar with Xcode code snippets, then I recommend reading the following article:
There are a couple of open-source repositories on GitHub sharing such code snippets, but I struggled to get an overview across all repositories. Also, I did not want to download code snippets from each repository and import them into Xcode immediately.
I wished there was a tool that could act as a staging area. An application that allows me to explore code snippets from the Swift and iOS community, view and edit the snippets before adding them conveniently into Xcode.
I created and open-sourced a macOS application, XCSnippetsApp, to address my needs.
Nearly 200 code snippets are available thanks to various open-source repositories which I listed in my app's README file. If you know about other helpful repostories, please let me know and I will also include their code snippets.
New code snippets, once available, can be imported into XCSnippetsApp
without re-installing the app. Checking for updates is the only time that the app needs internet connectivity. Otherwise, you can work entirely offline. The following gif shows you how to download new snippets within the app.
If you have code snippets you want to share with the community, then this is how:
- Find your Xcode code snippets. Those are stored as property list files with extension
codesnippet
in folder~/Library/Developer/Xcode/UserData/CodeSnippets
Create a pull request adding your files to my repository on GitHub.