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?
For Xcode 10 to make a Snippet,
1) Select the resign of code you want to reuse in future.
2) Click the right button.
3) In the context menu, select "Create Code Snippet". The Snippet Library will appear with a new snippet created.
to create a snippet you can do it in the following way:
- menu editor and select Create Code Snippet:
if you want your variables to be highlighted in gray you have to surround the variable in the following way, <# name #>:
example:
public let <#name#>: <#type#>
来源:https://stackoverflow.com/questions/51240838/adding-code-snippet-in-code-snippet-library-xcode-10