Post WWDC 2018 Update

Starting with Xcode 10 and Swift 4.2 you will now be able to use #warning again like so:

#warning("TODO: Clean up this code after testing")

This will show up as a warning in Xcode just as expected!

This works even in combination with #if checks, for example the following will only show a warning if your target platform is iOS:

#if os(iOS) #warning("this code is untested in iOS") #endif

There's also #error if you want your build to fail.

Pre WWDC 2018 Answer

In Swift using XCode 6 you can use different kinds of landmarks for different purposes. Here's what Apple says about it:

Xcode now supports //MARK:, //TODO: and //FIXME: landmarks to annotate your code and lists them in the jump bar.

So for setting a warning with a description you would use something like this:

//TODO: Clean up this code after testing

If you just want to set a short mark (assuming you will remember what to do), use this:

//FIXME

EDIT: These landmarks however only appear in the jump bar of XCode which might not be what you wish for and what one would expect – especially from the //TODO: and //FIXME marks. I've filed a radar on that: #17776817. Hopefully Apple will add this in the coming builds in XCode 6.