Recently when I was using Xcode 10 beta 3, I tried to make a code snippet and add it to the code snippet library.
But the drag drop cannot be done as the code snippet library is detached in Xcode 10, and hides when I click on a code.
How to add code snippet in code snippet library in Xcode 10?
With a code file open in the editor, choose Snippets > Insert Snippet from the right-click menu, then My Code Snippets. You should see a snippet named Square Root. Double-click it. The snippet code is inserted in the code file.
If you want to create a new code snippet in Xcode, you just need to select a portion of code, right-click on it and choose the option Create code snippet. Then, you can edit and delete it by pressing cmd + shift + L .
Creating a code snippet is easy. Just select the code that you want to make a snippet and drag it to the code snippet section towards the bottom right of the xcode. A window will appear and there you can rename it and add a description.
After some time found out.
Select the code
you want to add to library. Right-click on it and click on Create Code Snippet
from the pop-up menu.
Apparently upto Xcode 9.x.x, this option was not there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With