Member-only story

Debug with the DEBUG preprocessor macro in Xcode

Testing shouldn’t mean using your production backend

Steven Curtis
3 min readApr 5, 2020
Photo by Zan on Unsplash

Logging is a great way to know what is going on in your code, and solving those little problems (that may keep rearing their heads as you develop as a programmer).

But what if you could use Macros to use different sections of code according to different situations. One such tool for this is the DEBUG Preprocessor Macro.

Difficulty: Beginner | Easy | Normal | Challenging

Prerequisites:

  • Understanding of branching in Swift is assumed(guide HERE)

Terminology

Build: A version of an App

Debug: A process to identify and remove errors

Macro: a programmable pattern which translates a certain sequence of input into a preset sequence of output

Preprocessor Macro: a preprocessor is a macro processor that is used automatically by the compiler to transform the app before compilation

Release: The final distribution version of an App

Moving on from logging

Logging to the console gives you access to a great debugging tool. I’ve already written a guide to…

--

--

No responses yet