Reputation: 11567
How to drag and drop a custom code to code snippets and use a shortcut text for auto-fill as we did in Xcode < 10
And how to remove the snippets?
Upvotes: 39
Views: 11262
Reputation: 16446
In Xcode select line or code to be added in code snippet and then
Option1
Goto Editor
choose the Create code snippet
Option 2
Select Code you want to add to snippet right click and choose create code snippet
Choose any snippet and press backspace
If you want to edit already added code snippet it is easy. just open code snippet library list (from right corner) from the list select code snippet you want to edit and press SPACE BAR button
Warning : My Xcode crashes randomly couple of time during removing or adding code snippet make sure you save your work (Xcode 10 BUG) :]
Hope it is helpful
Upvotes: 47
Reputation: 620
To add new code snippet in XCODE 10
, you can just:
- select the codes that you want to create snippet
- then right-click on those selected codes
- choose Create code snippet.
And to remove the code snippets:
- Just click on the {}
icon on the top right nav
- Then select on the code snippet you want to delete
- Press Backspace
Upvotes: 8
Reputation: 5327
Click on the show panel icon on top right of the Snippet popup window.
Window will expand to show the code and also the Edit button
Upvotes: 3
Reputation: 1389
Add code snippet
Same way as before:
Edit and Delete code snippet
Type cmd + shift + L
and you will see the following UI:
For more information about Xcode code snippets check this article.
Upvotes: 13
Reputation: 2968
If you still want to use Drag & Drop
way to create a new code snippet as we did until Xcode 9, you can open Library dialog (shortcut: [Command]
+ [Option]
+ [Shift]
+ [L]
) and drag the source code into the dialog.
Upvotes: 4