Swift code snippets for Xcode
Run sh setup.sh
to copy all the snippets into the Xcode snippets folder.
- Select all files in the
snippets
folder and copy them to:~/Library/Developer/Xcode/UserData/CodeSnippets
. - Launch / Restart Xcode.
- Use shortcut indicated by each .codesnippet’s filename to autocomplete the code snippet.
e.g.
alrt
- ForUIAlertController
creation.cvds
- ForUICollectionViewDataSource
methods.initc
- ForinitWithCoder:
initialiser method.initf
- ForinitWithFrame:
initialiser method.gcd
- For Grand Central Dispatch code example.mark
- ForMARK: -
Swift comment / directive.stp
- Forsetup
andsetupConstraints
methods.stpo
- For overridensetup
andsetupConstraints
methods (e.g. when subclassing BaseView-swift framework)tvd
- ForUITableViewDelegate
methods.tvds
- ForUITableViewDataSource
methods.