5 Quick Tips for the Xcode 11 Minimap

Written by Reinder de Vries on February 7 2020 in App Development

5 Quick Tips for the Xcode 11 Minimap

Xcode 11 introduced a useful feature: the code editor now has a mini map. The minimap shows an overview of your code, that you can scroll through. And, as we’ll discuss in this article, it has a ton of super-useful-but-slightly-hidden features.

Just to be sure — this is the minimap in Xcode:

We’ll discuss 5 quick tips for using the minimap in Xcode 11:

  • Hover over the minimap to see functions, classes, properties, etc.
  • Hold Command to see a quick list of functions, classes, etc.
  • Click-and-hold inside the minimap to quickly scroll through your code
  • Organize your file better with // MARK: comments; they show in the minimap
  • Search a file for keywords, and the minimap shows you where they are

Ready? Let’s go.

  1. See Classes, Functions, Properties on Hover
  2. Hold «Command» to See a List of Functions
  3. Navigate & Scroll the Page Quickly
  4. Organize Your Code with “MARK” Comments
  5. See Search & Find Keywords at a Glance
  6. Further Reading

Sublime Text, my other most favorite code editor, has had a minimap feature for ages. It’s great to see Xcode finally catch up! By the way, if you hate the minimap, you can disable it by pressing Control + Shift + Command + M, or via the Adjust Editor Options button.

1. See Classes, Functions, Properties on Hover

The purpose of the minimap is to show you a global outline of the code, and to help you navigate your code better. You could view the mini map as a birds-eye view of your code.

If you look closely, you’ll see that the minimap actually uses the same colors and syntax highlighting as the editor itself. The same goes for changes (Git) in your code, and breakpoints, and even the current cursor position. All that is visible in the minimap!

OK, now hover over the minimap with the mouse cursor. As you move over properties, functions, classes, etc., their names show up on top of the minimap. When you click the hovered-over item, the editor moves over to that part of your code. This helps you navigate your code.

Here’s an example:

Learn how to build iOS apps

Get started with iOS 13 and Swift 5

Sign up for my iOS development course, and learn how to build great iOS 13 apps with Swift 5 and Xcode 11.

2. Hold «Command» to See a List of Functions

Another great feature is this: as you hover over the minimap, hold the Command key. This will display a list of all the classes, functions, properties, types, etc. in the current Swift file.

Like this:

And there’s more!

  • You can click an item in the list, and the editor will then skip to that part of your code.
  • Right now, // MARK: style code comments will also show up in the list (see below)
  • This list is similar to the one found at the top of the editor, at the end of the breadcrumb

3. Navigate & Scroll the Page Quickly

The minimap is essentially one huge scrollbar. Try it for yourself: move your mouse over to the mini map, then click-and-drag. This will scroll the code editor, just like a normal scrollbar would. Neat!

4. Organize Your Code with “MARK” Comments

In Swift code files, you can use a few kinds of code comments to document your code. One of them is // MARK:, previously called #pragma mark in Objective-C. Its siblings are // FIXME: and // TODO:.

Here, check it out:

The cool thing about these types of code comments, is that they show up in the minimap as well. You can quickly get an overview of parts of your code, if you comment it that way.

The syntax is simple:

// MARK: Whatever you type here

Right now, // FIXME: and // TODO: won’t show up in the mini map, but they probably will in the future. The list at the end of the breadcrumb, atop the editor, does show these fixmes and todos, though.

5. See Search & Find Keywords at a Glance

The last quick tip for the Xcode 11 minimap involves Search & Find in Xcode. You can search your Swift file for text by pressing Command + F, and use Search and Replace with Command + Option + F.

Xcode will automatically search closest to your cursor position first, which means it’s easy to lose your place in a code file as you continue searching for other occurrences. The minimap helps here:

It’ll highlight occurrences of your search string in the minimap, so you can see where a keyword is at a global level. Neat!

Note in the above screenshot that the minimap is really accurate. The currently highlighted search occurrence shows up in yellow in the editor, and it’s also displayed as yellow in the minimap. In fact, the minimap is an actual color representation of all the code in the file. Neat!

Learn how to build iOS apps

Get started with iOS 13 and Swift 5

Sign up for my iOS development course, and learn how to build great iOS 13 apps with Swift 5 and Xcode 11.

Further Reading

The new minimap in Xcode proves to be quite useful for navigation in a Swift code file, and helps you get a global outline of your code. Here are the quick tips we discussed once more:

  • Hover over the minimap to see functions, classes, properties, etc.
  • Hold Command to see a quick list of functions, classes, etc.
  • Click-and-hold inside the minimap to quickly scroll through your code
  • Organize your file better with // MARK: comments; they show in the minimap
  • Search a file for keywords, and the minimap shows you where they are

Want to learn more? Check out these resources:

Reinder de Vries

Reinder de Vries

Reinder de Vries is a professional iOS developer. He teaches app developers how to build their own apps at LearnAppMaking.com. Since 2009 he has developed a few dozen apps for iOS, worked for global brands and lead development at several startups. When he’s not coding, he enjoys strong espresso and traveling.