Delete a User Code Snippet in Xcode
Asked Answered
S

8

46

How ??? I can not delete a custom code snippet in Xcode.

Simonsen answered 7/5, 2011 at 19:31 Comment(3)
#887904Asteria
#5265948Asteria
and how to add them in the first place?Washwoman
S
113

I did these steps :

  • Select needed code snippet and press Delete key.
  • A pop-up window will appear , and select Delete button.
  • Remember that : this action cannot be undone.
Simonsen answered 4/11, 2011 at 19:15 Comment(4)
select snippet, delete-return (⌫↩) is the keyboard-fast way, but make sure you have the right thing selected ;)Basidiospore
So simple that you don't get it. 😄 Thanks!Karimakarin
I was trying to do this in Xcode 10, and it wasn't working. I closed the snippets library, reopened it and tried again. Eventually, it worked without having to restart Xcode. If It doesn't seem to work be persistent.Isabelisabelita
I had to delete all snippet's fields before being prompt the pop-ip window asking for confirmation of deletion. Weird.Corum
G
22

In the Library select the code snippet you want to delete and press Backspace. A confirm dialog will show up, click "Delete".

Gaulish answered 2/9, 2011 at 21:32 Comment(0)
D
5

Good question, I haven't found a way to do it from within Xcode, but they can be deleted from the Finder. The snippets are stored at ~/Library/Developer/Xcode/UserData/CodeSnippets/. Each one is a separate file that you can delete. Unfortunately they're named with an ID and don't give an indication of which one is which. They're XML files though, so either use a text editor or QuickLook to see the contents and recognise them.

Also, I've had to restart Xcode in order to get the deleted snippets to no longer show up.

Dispensatory answered 8/5, 2011 at 8:48 Comment(0)
C
4

I was having trouble, and after messing around a bit it finally worked. You select the user snip and hit the delete key. I tried this multiple times but it didn't work initially. This may be due to me running a prerelease version of Xcode though.

Curate answered 4/7, 2011 at 15:33 Comment(0)
C
0
  1. In Xcode 10, select snippet from snippet pop-up dialog.

  2. Then press Shift+

  3. After that just confirm your removal.

Note: This process cannot be undo at this moment.

Custom answered 24/1, 2019 at 16:24 Comment(0)
G
0

I was trying forever to delete the useless (to me) C++ ones, but apparently you can only delete the user-created ones in Xcode 10. Bummer.

Glyphography answered 20/3, 2019 at 13:43 Comment(0)
A
0

User-created code snippets are located in ~/Library/Developer/Xcode/UserData/CodeSnippets.

If your XCode UI for deletings snippets doesn't work as in my Xcode 10.2.1, you can navigate to this folder and either delete all user snippets with rm * or use some kind of cat/grep to find the ones you want to delete.

Abnormal answered 14/8, 2019 at 14:11 Comment(0)
P
0

In xcode select the code snippet Delete title and shortcut and save it after that select the same and press delete a confirmation box pops up asking you to delete or cancel the code snippet.

Philemon answered 26/11, 2019 at 12:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.