TODO and FIXME as warnings in Xcode
In Objective-C Xcode generate compile time warning by using #warning
preprocessor directive in your code. Unfortunately, this is not available when using Swift.
Sometime artificial warnings serve as an active reminder to fix your code or to implement some TODO issues.For example, checking the warnings before submitting can help us to prevent submitting an app with the staging base url.
To get warnings for tags like TODO, FIXME and WARNING in Swift we need to add little Run Script.
Just do the following:
-
Select your app target in the project overview.
-
Click on the Build Phases tab.
-
Click on + in the top-left to add a new phase.
-
Select New Run Script Phase.
In the allocated space for the script,enter the following:
This creates warnings for all your // TODO:
, // FIXME:
and // WARNING:
comment lines.
Now to create an artificial warning in your code just use either of the following: