#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.

Introducing alt.hack

For the last few months I’ve been working on a new game using SpriteKit and (of course) Swift. In a past life I used to be a game developer (tip o’ the hat to Blazing Griffin, the studio I co-founded back in 2011), and it’s been so great to get back into building games. Without further ado, let me introduce alt.hack, a hacking game for iOS and OS X loosely based on the hacking mechanic in Deus Ex: Human Revolution.

alt.hack, a hacking game coming to iOS

alt.hack, a hacking game coming to iOS

In alt.hack you play as an aspiring hacker, breaking your way through a series of increasingly well-defended networks. Every hack is a race against time as you capture your way across a network before security can trace you and kick you out. The game has a lengthy story mode, plus a fully-featured level designer (so fully-featured that I’ve used it to create every level in the game!) that lets you publish networks and see how other players fare against them.

I started Swiftalicio.us to document the things I was learning about Swift as I build alt.hack, and I’ll keep doing that as it moves closer to release. You might have noticed that a few of the more popular posts here (e.g. How to Setup a 2D Camera in SpriteKit) have a very game-specific focus — now you know why!