Excluding strings from Xcode project search - xcode

I have objects with similar names and when searching the project in xcode for e.g. currentTrack, objects with a name e.g. currentTrackList also appear in the search finder.
Is there a way to exclude strings or pick out e.g. only currentTrack and ignoring currentTrackList from search query?
I have heard about Code Pilot but never used it. Can code pilot do this?

If you look at the drop down in the search tab (next to the search icon there is a downwards arrow in the search field), there is an option called show find options, in that there is a section called Hits Must:
Change that to match search term
By default its on contain search term

Related

Global search in Xcode 10.1

I'm trying to search through my entire project using CMD + SHIFT + F.
When I'm searching for anything that contains a dot (.) in the query the search will not find anything even though I literally just copied it from the code. For example I am searching for this:
self.init
and I get "no results for self.init"
I can't find any option that maybe regular expressions would be activated.
How can I make XCode to find any string I type into the search field (even when it contains dots)?
Press command4, or shiftcommandf to open the left side menu. In there, you can search using regular text search, regex, and more.
When searching for plain text, make sure that you're not matching regex. For this, press the button next to Find and select Text from the dropdown:

What does the round icon inside Xcode's filter fields mean?

Maybe I'm just me that don't grasp the meaning of a simple thing, but I really can not understand the meaning of the round icon that is next to the search field of the panel objects of Interface Builder of Xcode. Someone would know help me?
That is the filter icon for Xcode, used to filter a list that is already showing.
In each filter field that's available you don't have to enter the beginning of the name to get a match. The most powerful of all the filters is the Quick Find feature (shown at the bottom), which doesn't even require the characters to be adjacent, for a match to be successful.
Did you know that you can also filter method names that appear at the top of your Editor?
Tap on the popup button:
Start typing to filter the list. As you can see, the entered characters don't have to be adjacent to produce matched results:
Contrast that to the search icon, visible at the top of the Find navigator panel:
There is also a filter field at the bottom of the Find navigator, to enable filtering through search results. I think it is supposed to resemble a half-filled magnifying glass, but it is missing the handle:
A filter field is also at the bottom of the Project navigator:
And, let's not forget about the filter field at the bottom of each of the library panels (Template library, Code Snippet library, Object library, and Media library). That really comes in handy, especially with all the UI components available on Mac OS:
But if you have a lot of files in your project, then I recommend using Quick Find (Shft-Cmd-O). You can type any letters for what you're looking for, and it digs up results of several types of objects, including file names and method names. It performs a powerful regex-style search that doesn't require the entered characters to be adjacent in the matched results. Notice that there is no filter icon here, because a list is not displayed before you begin filtering:

Project wide word matching search on Xcode 5

I'm using Xcode 5, and want to find a word (ex:variable name) not by substring match but by exact match (or prefix match). In file wide search (Command-F), I can use Textual search or regular expression search by clicking the arrow button just right of the glass icon and choosing "Edit Find Options...".
But, I cannot find any option to search on project wide search ("Find in Project", Shift-Command-F), in Xcode 5.
One thing I can do is run "grep -w" on Terminal.app. But, isn't there any way to search word in Project inside Xcode?
Well it seems that the search tool in Xcode 5 is a bit confusing for a lot of people. In my opinion Apple should have done a better work letting the user know of what is clickable and what not... That being said, here is how you access the different options:
Once we switch to the Find Navigator we see 3 components (Find>Text>Containing)
Now, you can click on any of them to select between different options (à la jumpbar)
And finally you can also click the In Workspace (or In Project) to change the scope of your search
In Xcode 6 the problem I was having was that my Framework folder wasn't being searched, even though it was clearly part of the project (but in /Library/Frameworks), and even when I had one of its files open with the string showing in the editor.
Changing the scope from In Project to My Scope (as shown) even allowed me to find the search string in non-frameworks folders.

Xcode: find in project NOT only whole words?

When I try to ⇧⌘F for convertPoint in my project, it does not find existing convertPointFromBase:, but shows only convertPoint:toView: etc.
How to make it search not only whole words? I cannot find any settings about searching.
In the find bar klick the little triangle next to the magnifying glass. In the popup select "Show Find Options". In the revealed options select "Hits must contain search term".

Searching in Xcode not finding results (searching my source)

I'm pulling my hair out on this and Google results are skewed since it thinks I want to find out how to code something.
My problem is that when trying to search my code with the String Matching box it finds nothing, even if I enter something that is on the screen below.
Is it Spotlight that is delivering these results? I'm not excluding anything in my Spotlight index so should I just rebuild the index?
At the top of the Xcode search field, you probably want to select:
Find > Text > Containing
rather than any of:
Find > Text > Matching
Find > References > Matching
Find > References > Containing
I did not (knowingly) switch this to "Text Matching" or "References", but there it was set. "Text Containing" is a more useful search type for most searches.
This happens to me after doing this: from editor, select a word, then right-click on it, then choose "Find Selected Symbol in Workspace".
As a consequence, the finder automatically sets itself to:
Find > Reference > Containing
To search for a given text, you have to re-set it to:
Find > Text > Containing
Sometimes this happens to me when the "In Selected Items" is selected in the combobox on the right side of the search string.
If this selected, you only get a search in whatever files are selected in your project window. Change it to "In Project" to search all your source files.
Note that the files need to be inside of your current Xcode project (just opening them from the finder won't add them.) You may also be interested in the "In Open Files" option, which is faster for large projects.
Even with all filters disabled as described in previous answers, Xcode still doesn't always find all occurrences of a string in some of my projects, even though these occurrences are reached just fine when choosing Jump to Definition.
To do a literal full text search (note, this is much slower than the pre-indexed search), you can create a Search Scope that just searches the full project folder, by adding a Folder location in the Scope editor:
I got stuck on this one because I didn't realize that I had to hit RETURN to see the search results, haha. Normally the results changes dynamically as you write, but Xcode 11 apparently doesn't have that feature yet.

Resources