Thursday, 27 March 2014

Box all your numbers in new literal syntax with find and replace

Xcode provides no shortcut to box your variables to use new literal syntax, and doing it by hand is seriously time taking.

A small approach to help is to use the "Find and Replace" option of Xcode (⌘ + ⌥ + F).

What to find? : Any word
What to replace with? @( matched word )

How to do it? with magic.. ;)
Use \1 in your replacement string to get the matched word.
Note: On Xcode 6+, Use $1 instead.

See the screenshot below. Hope this helps.

For Xcode 6+, 

If you have used any other solutions, please share them in comments.