Replace parameter multiple times in Xcode code snippets

后端 未结 2 1832
悲&欢浪女
悲&欢浪女 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 08:05

    This is not possible in Xcode 4.x at the time of writing (Sept. 2011).

    If you want this feature back in Xcode 4.x, please go to bugreport.apple.com and report a duplicate for this rdar that I just preported:

    Summary: Xcode 4 snippets with tokens of same name should sync while filling one of them.

    Steps to Reproduce:
    1. Define this snippet: extern NSString * const <#constant#>; NSString * const <#constant#> = @"<#constant#>";

    1. Drop it into your code.
    2. Hit tab to select instance of token <#constant#>.
    3. Type "NSMySuperCoolConstantString".

    Expected Results:
    5. NSString * const <#constant#> = @"<#constant#>"; should turn into NSString * const NSMySuperCoolConstantString = @"NSMySuperCoolConstantString"; as it used to do in v3.x.

    Actual Results:
    5. NSString * const <#constant#> = @"<#constant#>"; stays unchanged/unsynced.

    Regression:

    Notes:

    Here is the rdar reference for duping:
    rdar://10071607

    And here a copy on OpenRadar:
    http://openradar.appspot.com/radar?id=1327411


    While you're at it: Feel free to dupe this rdar as well:

    "Xcode 4: snippet functionality regressions"
    rdar://9192757
    http://openradar.appspot.com/9192757

提交回复
热议问题