Elye
Elye

Reputation: 60161

Xcode: How to find something only in specific file type?

In Android Studio, I could search something in certain file type using the File mask as shown below. e.g. I could search on Kotlin (*.kt) files only enter image description here

In Xcode, is it possible to do so as well? E.g. I would like to search only on the Swift file (*.swift). I don't see any filter as shown below, other than Ignore/Matching Case

enter image description here

Upvotes: 5

Views: 1562

Answers (2)

Andrej
Andrej

Reputation: 7426

An alternative way and arguably quicker way to do it is to just type the extension in the filter section below the list of matches.

enter image description here

Upvotes: 2

DarkDust
DarkDust

Reputation: 92354

Below the search field, there's an icon with three dots and a line above and below. In the default case, "In Workspace" is printed next to it.

Click this icon/text and a list of scopes is shown. Click the "+ New Scope…".

You can define complex rules for your scope, but in your case you would just need one: select File extension in the attribute field, is equal to in the condition field and swift in the value field.

You can give your scope a name and save it if you need it often.


But there is also a second solution: just do your search. At the very bottom of the search panel you see a circle icon with three lines, similar to the "ground" symbol used in electrics (IMHO); next to it is a text field with placeholder "Filter". Enter *.swift here to filter the search results for hits in Swift files.

Upvotes: 8

Related Questions