Xcode Find and replace in all project files

45,469

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

Share:
45,469

Related videos on Youtube

user426132
Author by

user426132

Updated on October 30, 2021

Comments

  • user426132
    user426132 over 2 years

    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.)

    • Enrico Susatyo
      Enrico Susatyo over 10 years
      I'm sure you can do this with cmd-shift-f and then selecting the replace mode?
    • Alladinian
      Alladinian over 10 years
      Click on 'Find' (in the search navigator) and choose 'Replace' from the dropdown.
  • Tim Beaudet
    Tim Beaudet about 9 years
    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.
  • Nostradamus
    Nostradamus over 8 years
    Thanks Tim - that MUST be a bug - I was trying to figure out why the search/replace button was still greyed out.
  • IceFire
    IceFire over 5 years
    are there shortcuts? ⌘3 opens find and search but can I also switch between find and replace?
  • Carson Holzheimer
    Carson Holzheimer over 3 years
    Wow that UX :'(