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:
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:
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:
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.
Breadcrumbs help you understand where you currently are inside a file:
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
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
// MARK: - Decoding
Insert a hyphen (-) before the group name to add a line separator:
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:
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
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:
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.
⇧⌘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 —
⇧. In the dialog that opens, you can press
⇥ to switch the scope of your search:
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
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:
To open the list of recent code locations, press
Navigate between declaration and usages
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:
If you don’t want to leave the current file, you can press
⌥Space to see the definition of a symbol in a popup:
Navigate between protocols and conforming types
If a protocol has conforming types, you will see the icon in the gutter. Properties and methods implemented in conforming types are also marked with .
Right-click this icon or press
⌥⌘B to see a list of all the implementations:
The icon appears next to the implementations. Clicking on this icon or pressing
⌘U will bring you to the protocol:
Similarly, you can navigate between super-methods and overriding methods. Click or press
⌘U to go to a super-method and (
⌘U) to go to its overriding methods.
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.
Subscribe to Blog updates
Thanks, we've got you!
AppCode 2022.1: Swift Support Improvements, Xcode 13.3 Support, and More
AppCode 2022.1 brings support for async sequences, postfix #if member expressions, isolation control specifiers for Swift actors, improvements for Swift Package Manager integration, better VoiceOver support, and more.
Writing Code Documentation in AppCode
Code documentation can save you a lot of time and headaches. On the other hand, it also takes a lot of effort to write and maintain it. In this article, we will look at the AppCode features that can help you create detailed and well-structured code documentation and keep it updated after code refact…
AppCode Starts 2022.1 EAP: Swift Support Improvements and Bug Fixes
Hi everyone, Today we are starting the Early Access Program for AppCode 2022.1, and the first build is already available for download. Language support Starting with this build, AppCode supports async sequences (SE-0298). Other improvements and bug fixes Separate color settings for associated …