Debug using Breakpoints in Xcode

Stop-start

Steven Curtis
6 min readJul 8, 2020

--

Photo by bruce mars on Unsplash

Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 11.4.1, and Swift 5.2.2

Coding is important, as you are building a product. Testing is also a crucial part of creating code, that is you are creating a project that is validated and in some sense correct.

Debugging helps you to work out those little problems and errors that exist in your project.

How are you going to do that, why are you going to do that and what does it give you?

Prerequisites:

  • You will be expected to be aware how to make a Single View Application in Swift, including adding UILabels and UIButtons
  • The code uses Force Unwrapping liberally, avoiding that is covered HERE
  • I’ve made the keyboard resign with THIS technique

Terminology

Breakpoints: a debugging tool that allows you to pause the execution of your program at a specific point in time

Why?

We all make mistakes. In programming these mistakes are often known as “bugs” that get into our software and cause problems.

So how can we know where our particular program is going wrong? One strategy is to see what the particular state of our program is at any particular time.

This article will refer to the debug area , which is highlighted in Blue in the image below

If it isn’t there in the top-right hand corner of Xcode you can select the following icon, and then the bottom bar should appear in you Xcode view.

Both logging to the console and breakpoints are ways that we can find out what is going on under the surface in our App. This article explains how they might be used!

The quality of life improvement

--

--

Recommended from Medium

Lists

See more recommendations