pragma mark in swift

I'm using the new Xcode 7 and Swift 2. Trying to get upto speed.


In Objective-c, I like to use :


#pragma mark - mystuff


I've read in online searches, that in swift I could use something like:

// MARK : - mystuff

But apparently, in Xcode 7, this does not work. Is there an alternative? I looked in the Swift 2 pdf book and it was not obvious.

Answered by OOPer in 63890022

Thanks. In fact I've believed the description I wrote above till now.

Re-EDIT:

You cannot put space between `MARK` and `:`.

Try this:

// MARK: - mystuff

You cannot put space between `//` and `MARK`, `MARK` and `:`.

Try this:

//MARK: - mystuff


EDIT: fixed example and added note for the latter space.

No, no, that's too complicated. The only necessity is that there is no space between MARK and the colon.

Accepted Answer

Thanks. In fact I've believed the description I wrote above till now.

Re-EDIT:

You cannot put space between `MARK` and `:`.

Try this:

// MARK: - mystuff

Thanks for the tip. 🙂

My first reply has a misunderstanding part, please move the Correct Answer mark, if you have some time.


By the way, I couldn't have found an offcial documentation about this feature, only now-not-found Xcode 6 beta 4 release notes had this description.


Landmarks

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


Though, I don't remember this leaded my misunderstanding.

pragma mark in swift
 
 
Q