#pragma mark Equivalent in XCode 6

Remember #pragma mark? In Objective-C code it’s a lovely way to make your methods a little easier to find in the Xcode source navigator. While Swift doesn’t have Objective-C’s preprocessor support (and good riddance) I’ve come across a few magic comments that, if conservatively used, can make your code a lot more readable: MARK, TODO, and FIXME.



The effect of MARK, TODO, and FIXME in Xcode 6

The effect of MARK, TODO, and FIXME in Xcode 6


Use // MARK: Section Description to break your code up into logical sections. I use MARK breaks to (among other things) group together methods that implement a particular interface or share some related function (e.g. touchesBegan, touchesMoved, &c.). Start your section description (the bit after MARK: with a single dash to set the code off with a separator.


Use // TODO: Message to your future self! to indicate places in your code that still need work.


As near as I can tell, FIXME works exactly like TODO. Take your pick, I guess — but try and stay consistent. I exclusively use TODO, but that’s just a personal preference.

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest Posts

  • Guard! Guard!

    Swift 2 introduced the guard keyword, a handy bit of syntactic sugar with semantics similar…

  • UIResponder and Swift 2.0

    I was revisiting an older Swift 1.0 project this morning, and discovered that, in the…

  • The App Classifieds

    I’ve taken a break from app development to launch something different: a classified listings site…