Embrace Xcode (clang) compiler errors

Have you ever felt the stress and frustration when your issue navigator is full of warnings and errors? My advice is: Leave your bad feelings behind.

Believe or not, compiler warnings and errors are your best friends.

Why am I saying this? Because the ability to catch bug, or a possible problem in your code at the early stage at the development allow you to fix it or redesign it before it goes
to production. And because the warnings and errors can help you better understand the problem, and finally you will be able produce better code. So that is why you won’t try to quickly fix them, looking for a temporary solution, where you can switch off the given warning!

Always get to the root cause, because you gain knowledge and the first step in problem solving always starts with the understanding of the problem.

Here are my tips for you:
1. Always switch on the static code analyser in Xcode.
2. Always solve the issues you have in the Issue Navigator first, before you are adding new functionality or code (see point #5 in The Joel Test).
3. Don’t run your code first, always build it (cmd ⌘+b). This is when clang generates the errors. If no errors, you can run your current project.
4. When you are unsure about the issue navigator is properly updated, try to clear (shift ⇧+ cmd ⌘+k , and build again (cmd ⌘+b).
5. Do whatever you want to do, but try not to make shortcut, or cheating when you need to solve those problems.

I hope with this short post I could help you again to produce better code, and getting a more valuable iOS/macOS developer.


Leave a Reply