123

I need to replace NSLog with DDLogVerbose in all files in the current project I am working on… What is an easy method to do this? (the search navigator only has search in it).

Also I need to add a line at the beginning of all .m files. How is this done quickly? (There are over 500 such files.)

shim
  • 9,289
  • 12
  • 69
  • 108
user426132
  • 1,341
  • 4
  • 13
  • 28

1 Answers1

265

Here are some pictures. In the toolbar search, you have to press 'Find' then a menu appears – pick replace. Now you can replace project-wide.

step 1 step 2

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Souleiman
  • 3,360
  • 4
  • 23
  • 21
  • 23
    I felt a bit silly when this wasn't working for me, but I found that after typing in the source of the replace I had to press enter for XCode to actually search through to find the matching strings. Otherwise the Replace / Replace All buttons remained disabled. – Tim Beaudet Jun 14 '15 at 17:17
  • Thanks Tim - that MUST be a bug - I was trying to figure out why the search/replace button was still greyed out. – Nostradamus Mar 08 '16 at 18:35
  • are there shortcuts? `⌘3` opens find and search but can I also switch between find and replace? – IceFire Oct 30 '18 at 07:21
  • 2
    Wow that UX :'( – Carson Holzheimer Oct 14 '20 at 00:29