Columns Breakpoints Xcode 13, WWDC 21

Aman Kesarwani
3 min readJun 15, 2021

--

Hi Folks,

Hope everyone enjoyed the week full of announcements like any other previous years with new iOS, Mac, and Watch OS and Developer tools.

Let us talk about one important feature which I was personally looking forward to since frequent usage of HighOrderFunctions, nesting of closures in Swift. So finally in recent WWDC -2021, Apple Engineers introduced the concept of Column Breakpoint. I understand this specific feature is not one of the core announcements of WWDC -21 but yes in my opinion it's a blessing in disguise for a developer.

What's the need?

The initial row line breakpoint was not granular enough. For example, while debugging some high-order function or looping over a sequence become repetitive and comparatively consumes more of the developer's precious time.

NOTE : This feature in available from Xcode 13

OK Got it, Enough of the theory

Let’s put it into work?

Please follow the following steps.

  1. Press Command (⌘) + Click on the expression where you want to add column breakpoint.
  2. An action popover appears → Select → Set Column Breakpoint

For example please check the image below →

At Line 70 a column breakpoint is set on expression convertedToVolume fucntion.

Setting a column breakpoint

Operations on column breakpoints —

  1. Enable/disable column breakpoints like the line breakpoint, by clicking on them.
  2. Likewise line breakpoint, drag, and release in order to remove the column breakpoint.
  3. We can also open the breakpoint editor by double-clicking on the same.
  4. The column breakpoint is also visible in the breakpoint navigator in Xcode.
Opening breakpoint editor (Double click on a breakpoint)

How to know the code execution is at a halt due to column breakpoint?

When column breakpoint halts the code execution, Xcode demarcates it with the light green color on the line where the code is halted. And there is a green highlight underline on the expression on which the column breakpoint was set.

For example please check the image below →

Line 70 is highlighted and convertedToVolume expression is underline and highlighted in green color

Halted code execution due to column breakpoint

Common Usage

A very common scenario showcasing the best usage of column breakpoint.

Multiple closures in a single line of swift code. Please check the below image for reference.

Multiple closures in single swift line

Using column breakpoint to check $0 value

Using column breakpoint to check $0 value

Reference — WWDC -2021 https://developer.apple.com/videos/play/wwdc2021/10209/

Thank you for reading the article. Please provide your valuable feedback/comments for improving the article.

Keep learning and keep growing.

Cheers !!!

--

--

Aman Kesarwani

iOS Application/Framework Developer| Mobile Architecture | SwiftUI | Swift, Objective C |