Text search though all .xib files in Xcode?

This seems like such a basic task, but I'm at a standstill.

How do you do text search in Xcode, although (XML content) of all .xib files in a project?

For example, all of our .xib files contain this line in the second line: com.apple.InterfaceBuilder3.CocoaTouch.XIB . Therefore, I think that searching for all project files for this line will return all .xib files, but Xcode insists on "0 meetings." I double checked that the project search options look correct.

I have to miss something obvious. (Or Xcode is somehow hardcoded to skip .xib files.)

I am trying to find all .xib files that reference a specific class (and text search seems the most direct).

Thank!

+45
xcode full-text-search xib
Oct 18 2018-10-18
source share
9 answers

I use grep in the terminal:

 grep -i -r --include=*.xib "TextToFindHere" /PathToSearchHere 

Xcode doesn't seem to be able to search for xib files, and my attempts to get Spotlight to view them were unsuccessful.

+76
Oct 18 '10 at 21:13
source share

Here is my handy team that never let me down. Run it from the project directory in the terminal.

to find. -name "* .xib" -exec grep "search text" {} \; -print

+9
Jan 29 '13 at 13:11
source share

I may be stupid, but using a spotlight is great for me on this.

+4
Aug 15 '13 at 17:20
source share

I understand that this is quite old, but I would suggest to those of you who will also encode other languages ​​on your computer and use Sublime Text 2 (this is wonderful), just open the iOS project folder in Sublime and use the find all function. Very fast, very reliable.

This is what I did to remove unused image resources from one of my large projects.

~ Happy coding =]

+3
Feb 22
source share

U can use this function in your bash profile:

 function grep_xib { grep -i -r --include=*.xib "$1" . } 

Then just call the terminal "grep_xib TEXT_TO_FIND". It is easier.

To create a .bash_profile file on your mac, follow these steps:

  • Launch terminal
  • Type "cd ~ /" to go to your home folder.
  • Enter "touch.bash_profile" to create a new file.
  • Modify .bash_profile with your favorite editor (or just type "open -e.bash_profile" to open it in TextEdit.
  • Enter ".bash_profile" to reload .bash_profile and update any features that you add.
+3
Sep 24 '13 at 11:44
source share

You can simply change the search scope in Xcode by specifying a new scope. Go to the search bar and under the search bar there is an icon with three dots (perhaps the default value is "In the workspace"). Press this button and in the SEARCH SCOPES section, click "New Area". Define it as "Name" / "ends with" / ".xib".

+1
Oct 05 '15 at 21:37
source share

This works if you use the service ...

 on run {input, parameters} display dialog "XIB Search Text" default answer "" set searchtext to text returned of result if (length of searchtext) is greater than 0 then tell application "Xcode" to set theProjectPath to (the project directory of front project) tell application "Terminal" set newWin to do script "cd " & theProjectPath & "; " & "rm " & theProjectPath & "/searchXIB.txt 2> /dev/null ; grep -i -r --include=*.xib " & searchtext & " . > searchXIB.txt ; exit" activate repeat while (exists newWin) delay 1 end repeat tell application "Xcode" set doc to open theProjectPath & "/searchXIB.txt" activate end tell tell application "System Events" keystroke "f" using {command down} keystroke searchtext end tell end tell end if return input end run 
0
Jul 24
source share

Open the project folder in sublime text and search in all files, very simple and convenient.

0
Jul 03 '14 at 18:49
source share

I had the same problem and resolved it with some console commands.

1) Open a terminal on your Mac

2) run the command grep -i -r -include = *. xib "searchtext" / your / project / path

It will search the path "/ your / project / path" and print the full path for all xib files that use "text search".

Hope this helps you!

0
Feb 24 '15 at 6:35
source share



All Articles