Little big improvements in Xcode 15

⋅ 4 min read ⋅ Xcode Xcode 15 WWDC23

Table of Contents

Xcode 15 gets a lot of nice improvements in WWDC 2023. In this article, I will briefly introduce you to some that I find interesting.

  1. Better code completion for methods with many default parameters.
  2. Context awareness.
  3. Documentation Preview.
  4. Quick Action.
  5. Bookmark.
  6. Format to Multiple Lines.

Methods with many default parameters

Last year in Xcode 14, we got a way to select parameters using fuzzy search.

But it is quite hard and error-prone for methods with many parameters with similar names, e.g., the frame modifier.

In Xcode 14, you can select parameters which match the search term.
In Xcode 14, you can select parameters which match the search term.

This year, you can navigate to all possible combinations of those parameters by pressing the right arrow key . You can browse them using the up and down arrow key.

  1. Press the right arrow key to expand the options.
  2. Then, use the up and down arrow to navigate.
Expand all possible combination of parameters.
Expand all possible combination of parameters.

This technique also works with fuzzy search.

In the following example, we search for the "framemax". Once we press the right arrow, Xcode will show only combinations that contain the word "max".

Work with fuzzy search.
Work with fuzzy search.

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

Sponsor sarunw.com and reach thousands of iOS developers.

Context awareness

Code completion and suggestion are smarter across the board.

For example, Xcode can suggest a class or struct name that matches the file name.

Xcode suggests a symbol name based on the file name.
Xcode suggests a symbol name based on the file name.

Completions also got better context awareness. It can give you better suggestions based on where you initiated the suggestion.

When trying to add a modifier to a Text view, it shows modifiers related to Text, e.g., font and bold.

Xcode suggests modifiers related to a Text view.
Xcode suggests modifiers related to a Text view.

If you try this on an image view, you will be suggested with resizable and renderingMode.

Xcode suggests modifiers related to an image view.
Xcode suggests modifiers related to an image view.

On a VStack, it would show padding, which is the most frequently used modifier for this view.

Xcode suggests modifiers related to a VStack.
Xcode suggests modifiers related to a VStack.

It is also smart enough not to suggest the same modifier twice. In Xcode 14, you might be suggested to use the .font modifier twice.

Xcode 14 vs. Xcode 15.
Xcode 14 vs. Xcode 15.

Documentation Preview

Xcode use markdown-flavored markup syntax for code documentation.

In Xcode 15, we got a "Documentation Preview" assistant, which will show a rendered version of your document.

You can preview your document in real time and ensure it looks like what you expected.

To use it, open the Assistant panel in either one of three ways:

  1. Editor menu > Assistant.
  2. Shortcut ⌃ – Control + ⌥ – option + ⌘ - command + ⏎ Return.
  3. Choose "Editor icon", then "Assistant".

Once you open the Assistant panel, select "Documentation Preview" from the jump bar.

Select "Documentation Preview" from the jump bar.
Select "Documentation Preview" from the jump bar.

Then you can see the preview of your editing documentation update in real time.

Documentation preview update in real-time.
Documentation preview update in real-time.

Quick Action

This might be my favorite feature in Xcode 15.

You can think of Quick Action as Command Palette that you usually see in other editors (the one with command + K).

Quick Action lets you access all of Xcode's menu options.

You can use it by pressing Command ⌘ - command + ⇧ - shift + A.

With all new features added to Xcode every year, at some point, you wouldn't be able to remember them or run out of key bindings. This Quick Action would be your savior.

In this example, I use it to create a Swift file and generate a memberwise initializer.

Quick Action.
Quick Action.

I don't need to move a mouse, remember shortcuts, or find commands in the context menu. Love it.

Bookmark

Xcode 15 introduces a Bookmark.

You can use a bookmark to annotate a specific line of code or symbol in your code so you can quickly return to it later.

To add a bookmark:

  1. Right-click on the line of code that you want to bookmark.
  2. Select "Bookmark" from the context menu.
Right-click on the line of code that you want to bookmark.
Right-click on the line of code that you want to bookmark.

To get back to your bookmarks:

  1. Open the new "Bookmark Navigator", the third tab in the Navigation pane.
  2. You can either click it or use shortcut ⌘ - command + 3.
  3. You can see all bookmarks in your project there.
Bookmark Navigator
Bookmark Navigator

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

Sponsor sarunw.com and reach thousands of iOS developers.

Format to multiple lines

Xcode 15 also adds a new refactor command that turns a line of multiple parameters into multiple lines.

This is very helpful for methods with many parameters.

To use this new refactor command:

  1. Move the cursor in the parameter list you want to format (between open and closed parentheses).
  2. Right-click and select "Refactor" > "Format to Multiple Lines".
Format to multiple lines
Format to multiple lines

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 preview UIViewController in Xcode Previews

You might not be aware that you can enjoy the benefit of Xcode Previews even though you are still using UIKit. In this article, I will show you how to preview a view controller using Xcode Previews.

Next
How to test In-App purchases in Development

You can't use your Apple ID when making an in-app purchase during the development. Let's learn how to do it.

← Home