Replace parameter multiple times in Xcode code snippets

后端 未结 2 1831
悲&欢浪女
悲&欢浪女 2021-01-31 07:39

Can I create a custom snippet that takes a parameter that is replaced multiple times inside the code?

I tried something like:

<#class#> instanceOf&         


        
2条回答
  •  盖世英雄少女心
    2021-01-31 07:59

    In Xcode 10 we can replace placeholder tokens with the same name by doing this:

    1. Highlight the first token.
    2. Add other tokens with the same name to the selection by pressing ⌥⌘E once for each token. ⌥⇧⌘E selects previous tokens.
    3. Start typing. This activates multiple cursors so each token gets replaced.

    It's not as quick as replacing every token with the same name by default, but it does give you more control over what gets replaced.

提交回复
热议问题