01 logo

iOS Native Development - Searching in Xcode

Different methods of searching in Xcode

By ConficlePublished 3 years ago 3 min read
5

Hello, we are back with our next article in our series of iOS Native Development - Searching in Xcode. Before starting this article, in case you have directly jumped to this article you can refer to our previous article Introduction to Xcode.

In this article we will explore various ways of searching in Xcode. Let’s start without wasting any further time.

1. Find option in status bar

First option in our list is to use the ‘Find’ option in the status bar. It has got multiple options to perform search within the code file or at project level. To perform the search in the code file select the code and select ‘Find’ from status bar. You will get a search bar on top of your code file in the editor. Alternatively you can use keyboard shortcut command + f to find and command + g to traverse for your search text.

Searching on project level using the ‘Find’ option from the status bar or keyboard shortcut command + f will take you to find the navigator in the left panel which we will cover in detail in the section below. Refer figures below.

2. Xcode search bar

While using Xcode any time press command + shift + O and a search bar will appear on Xcode. Start typing the name of any class, method, protocol or variable. You will get a list of references matching your search string. Click on the class, method or protocol in the list and you will be navigated to that file. Refer figures below.

3. The find navigator

Next option in our list is to use find navigator. This option is used for finding anything in your entire code base. You can open find navigator by using command + f at the project level or by selecting the fourth option on top in the left side panel.

Type the text you want to find in the search navigator and you will find all the references of your search text in the form of the list below the search bar. Search can be case sensitive or insensitive. Search can be performed for text in middle, start, end or exact match.

Search results will contain references to your search text in the entire code base and are displayed in the form of a list below the search bar. You can also filter out your search result using the filter bar given at the bottom.

Default search scope is project or workspace. However you can add your custom search scope by selecting ‘New Scope’ as shown in the figure below. Custom search scope provides various ways of restricting your search to very specific use cases. This feature is very useful in large applications. For example let's say we want to perform search only in an authentication module and that module contains all files having word ‘authentication’ in their name. So we can create a custom search scope to perform search only in files whose file name contains authentication. Once created you can also edit your search scope or switch back to default search scope at any point of time.

4. Searching in console

Searching can also be performed in the console while the application is running. Select the console in bottom and press command + f. A search bar will appear on the top of the console as shown in figure below. You can use command + g to traverse for your search text.

That’s it for this article. We hope this article helps you to gain more speed in your day to day development. Efficient searching can increase productivity of a developer to marginal level in case of large applications. We will be back with our next article where we will explore code debugging in Xcode. Till then please stay tuned.

Thanks for reading this article. If you have any queries related to this topic or iOS, Objective C and Swift. Please write us at [email protected] or direct message us on instagram at conficle(instagram username).

Also keep watching this space for upcoming articles on iOS development, software development and technology concepts.

how to
5

About the Creator

Conficle

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2024 Creatd, Inc. All Rights Reserved.