Bookmark in Xcode 15

⋅ 4 min read ⋅ Xcode Xcode 15 WWDC23

Table of Contents

Xcode 15 brings one of the great features to Xcode, Bookmark.

With a bookmark, you can do essential functions that you might expect from a bookmark:

And Xcode also has some advanced features to enhance the usability of the bookmarks you created:

Let's go through all of these features one by one.

Bookmarks Navigator

Since we can create a bookmark in Xcode 15, we need a place to see all of them.

Xcode has a new Bookmarks Navigator, which lists all of your bookmarks.

You can access this Bookmarks Navigator from the navigator area. You can do this in three ways.

  • You can click the bookmark icon from the navigator area.
  • You can access it through View Menu > Navigators > Bookmarks.
  • The quickest way might be via the shortcut, ⌘ - command + 3.

All of your bookmarks will be shown here. In this example, I have only one bookmark.

Bookmarks Navigator.
Bookmarks Navigator.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

How to create a bookmark

There are three ways to create a bookmark in Xcode.

  1. Create a bookmark on a specific line of code.
  2. Create a bookmark for the whole file.
  3. Create a bookmark from Search queries.

Bookmark on a specific line of code

To create a bookmark on a specific line,

  1. Right-click on that line.
  2. Select the first Bookmark command (The one with the line number).
Bookmark on a specific line of code.
Bookmark on a specific line of code.

After you create a bookmark, you will see a bookmark icon on that line's trailing edge.

Bookmark indicator.
Bookmark indicator.

Bookmark on the whole file

To create a bookmark for the whole file, you do the same step as bookmark on a specific line of code, but instead of selecting the first Bookmark command, you select the second one (The one without a line number).

Bookmark on the whole file.
Bookmark on the whole file.

Bookmark from Search Queries

You can also create bookmarks from Search Queries.

I think this is the most helpful way of creating a bookmark.

I usually add a // TODO: comment for a code I want to improve later. But lacking a way to view all of them makes it challenging to keep up and resolve my todos.

With Bookmark, I can create bookmarks from search queries, which is // TODO: in this case, and easily view them from Bookmarks Navigator.

To create bookmarks from Search Queries.

  1. Do a search like you normally do.
  2. Right-click on one of the results, and choose Bookmark "", in this case, Bookmark "Find //TODO:".
Right-click on one of the results.
Right-click on one of the results.

After that, all search results would be shown under Bookmarks Navigator.

Bookmarks from Search Queries.
Bookmarks from Search Queries.

Those are the three ways to create a bookmark in Xcode.

Once you get a bookmark, you can make it more readable using one of these operations.

  1. Bookmark Naming.
  2. Put bookmarks into a group.

Rename

By default, Xcode will use file names or search queries to describe bookmarks.

Bookmark descriptions.
Bookmark descriptions.

Overtime, you might forget why did you even bookmark them in the first place.

Luckily, you can create a custom description using either of these three methods.

  1. Click on the bookmark icon in the code editor. The text field will show up for you to put a description.
Click on the bookmark icon.
Click on the bookmark icon.
  1. Click on a bookmark in the Bookmarks Navigator and press the return key.
Bookmarks Navigator
Bookmarks Navigator
  1. Right-click on a bookmark in the Bookmarks Navigator and select "Edit Description".

Here is an example where I rename "// TODO:" search queries to "Todos".

Custom description.
Custom description.

How to group bookmarks

You can also put multiple bookmarks into a group.

This feature might interest you if you have multiple bookmarks that sit across multiple places but are tightly related to each other.

To do that:

  1. Create a group by right-clicking and selecting "New Group" in the Bookmarks Navigator pane. Name the group however you want.
  2. Drag bookmarks into the group.
Group bookmarks
Group bookmarks

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Bookmarks as To-do list

The last thing you can do with a bookmark is use it as a to-do list.

A checkbox will appear if you hover your mouse over a non-search-queries bookmark.

You can click to mark the bookmark as completed.

Click on a checkbox to mark a bookmark as completed.
Click on a checkbox to mark a bookmark as completed.

The fact that this feature doesn't support bookmarks created using Search Queries makes it less useful for me because that's how I bookmark my "// TODO:" items.

And even if it works with search query bookmarks, I think removing the bookmark is more reasonable than marking it as done.


Read more article about Xcode, Xcode 15, WWDC23, or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Buy me a coffee Tweet Share
Previous
How to use NSAttributedString in SwiftUI

Learn how to use an old NSAttributedString inside a SwiftUI app.

Next
How to Filter an Array in Swift

Swift Array has an instance method, filter(_:), that removes unwanted elements from the resulting array.

← Home