Embrace Xcode (Clang) Compiler Errors
Compiler errors and warnings don't exist just to clutter your IDE. Here are some tips on dealing with errors you'll find in Xcode.
Join the DZone community and get the full member experience.Join For Free
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:
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).
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.
When you are unsure about the issue navigator is properly updated, try to clear (shift ⇧+ cmd ⌘+k , and build again (cmd ⌘+b).
Do whatever you want to do, but try not to make shortcuts 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.
Published at DZone with permission of Peter Molnar, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.