Adding code snippet in Code Snippet Library (Xcode 10)

﹥>﹥吖頭↗ 提交于 2019-12-03 23:33:10

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.

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:

  1. menu editor and select Create Code Snippet:

  1. In the box that appears, fill all the information of your 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#>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!