When Swift debuted, we said goodbye to using #pragma
pre-processor definitions to organize our code. Don’t worry, Xcode still has our backs. We can use a few different “special” comments in our code and Xcode will pick up on them and display them in its jump bar:
The extra dash character in the name of our MARK gets us those sweet separators in the source navigator dropdown.
Xcode also supports a similar bit of functionality for TODO and FIXME comments. They’ll show up in bold in the same dropdown.
1 | func launch() { |
As a bonus, we can use a little regex magic to get Xcode to generate build warnings for TODO and FIXMEs. We’ll just add a new Run Script build phase to our project that contains:
1 | KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:" |
Source: jeffreysambells