A few days ago, I learned from @coffmanben that XCode has a built-in Clang Static Analyzer. The Analyzer looks through your source code on each build and finds bugs in your C, C++, and Objective-C code. I’ve been using it for a day now, and really love seeing the logic flaws in my code that I can easily fix.

The errors show up in the Issue Navigator alongside with all the other issues in your code. Here is one issue I found in code I was using yesterday:

To turn on the Analyzer, just follow these simple steps:

Go to your project’s Build Settings

Search for the Analyze During ‘Build’ setting and expand it

Select Yes for the Debug option

Happy Debugging!

Enjoy the article? Join over 20,000+ Swift developers and enthusiasts who get my weekly updates.