AppCode Tips & Tricks

Navigation in AppCode

Navigating through files and source code, especially in complex projects, can eat up a lot of time, which is why it is essential to learn how to move around quickly in your IDE. AppCode provides plenty of navigation features that can help you move faster.

In this blog post, we’ll take a look at some of the most helpful navigation tools, settings, and shortcuts that you can add to your arsenal.

Adjust the Project tool window

Using the Project tool window is the simplest way to explore a project. To show/hide the tool window, press ⌘1. You can also press ⌘1 to shift the focus from the editor to the Project tool window.

Normally, you need to double-click a file in the tree to open it in the editor. But if you want to open a file with a single click instead, select the Open Files with Single Click option from the menu that opens when you click the gear icon on the toolbar:

Project tool window settings

In the same menu, you can adjust many other settings. For example, if you want the file that is open in the editor to be selected in the tree, check the Always Select Opened File option. If you often switch between Xcode and AppCode, you can select the Xcode Order option to have the same file order in both IDEs.

Like in any other tool window, you can use the Speed Search functionality to locate a file quickly. Just start typing its name to have all the occurrences highlighted:

Speed Search

Jump to the navigation bar

The navigation bar is a compact alternative to the Project tool window. Press ⌘↑ to bring it into focus, and use the keyboard to explore the project structure and open files in the editor:

Navigation bar

If the navigation bar is hidden (View | Appearance | Navigation Bar), you can bring it up in the editor by pressing ⌘↑. This navigation bar will disappear again when you click off of it.Navigation bar in the editor

Use breadcrumbs

Breadcrumbs help you understand where you currently are inside a file:

Breadcrumbs

You can place the breadcrumbs at the top or bottom of the editor, or you can hide them. To do this, right-click the breadcrumbs and choose your preferred option.

Explore code structure

You can use the Structure tool window to view a tree of the classes, methods, and properties of any source file. To do this, press ⌘7:

Structure tool window

Like in Xcode’s Symbol Navigator, you can use the // MARK: (for Swift) or #pragma mark (for Objective-C) comments to group the symbols.

For example, this comment will create a new group called Decoding:

// MARK: - Decoding

Insert a hyphen (-) before the group name to add a line separator:

Groups in the Structure tool window

Use the toolbar at the top of the tool window to sort symbols by their type, name, or visibility.

Find all files with specific text

Find in Files is one of the most popular actions in the IDE. Anytime you want to find all occurrences of a specific string of text in your project, just press ⇧⌘F and type it in the search box. To narrow down the search, select where you want to look for this text: in the whole project or in a specified module, directory, or scope:

Find in Files

If you want to show all usages of a code symbol (variable, function, class, etc.) in a separate tool window, place the caret at this symbol and press ⌥F7. To show all usages in a popup, press ⌘⌥F7:

Show usages in a popup

AppCode searches for usages in the scope specified in the Find in Files dialog. You can change the scope by clicking the gear icon in the bottom-left corner of the tool window:

Find Usages settings

If only one usage can be found, you may want to highlight it in the editor instead of showing it in a separate tool window. Select the Skip results tab with one usage checkbox to enable this behavior.

Search everywhere

Press ⇧⌘O to find a file by its name, ⌘O to find a class, ⌥⌘O to find a symbol, and ⇧⌘A to find an IDE action. If you don’t want to memorize these shortcuts, you can remember just one — Double . In the dialog that opens, you can press to switch the scope of your search:

Search Everywhere

If you cannot find a setting or don’t remember a shortcut for an action, double will help. For example, if you want to disable breadcrumbs, just press twice and start typing Breadcrumbs:

Search everywhere

Here you can see all the breadcrumbs settings available in the IDE, and you can use toggles to show/hide breadcrumbs or change their location.

Go to recent files and locations

You can open the list of files you’ve recently been working on by pressing ⌘E. To narrow down the results to edited files only, select the Show edited only checkbox:

Recent files

To open the list of recent code locations, press ⇧⌘E:Recent locations

To navigate to a declaration of a property, method, class, or other symbol, press ⌘B. The same action invoked on the actual declaration of the symbol will act as Find Usages, showing you the list of that symbol’s usages:

Go to declaration

If you don’t want to leave the current file, you can press ⌥Space to see the definition of a symbol in a popup:

Quick definition

If a protocol has conforming types, you will see the Go to implementation icon in the gutter. Properties and methods implemented in conforming types are also marked with Go to implementation.

Right-click this icon or press ⌥⌘B to see a list of all the implementations:

Go to implementation

The Go to protocol icon appears next to the implementations. Clicking on this icon or pressing ⌘U will bring you to the protocol:

Go to super-method

Similarly, you can navigate between super-methods and overriding methods. Click Go to super-methodor press ⌘U to go to a super-method and Go to overriding method (⌘U) to go to its overriding methods.

Summary

AppCode provides many more navigation tools and features than we could include in this blog post. If we haven’t mentioned some of your favorites, please mention them in the comments below.

For more information on navigation in AppCode, go to the Code navigation section of our documentation. If you want to learn more about the navigation features and shortcuts, try the IDE Features Trainer plugin bundled in the newest versions of AppCode. To begin learning, select Help | Learn IDE Features from the main menu.