In Objective C, we can use
to mark sections of my code in the symbol navigator. They are very helpful in dividing your code into logical sections. To know more about why pragma marks are useful please refer to my other post: Organizing and structuring your code using Pragma mark.
But this annotation is not available in Swift. As soon as I switched to Swift, one of the main construct I found missing while writing code was pragma mark.
Fortunately, apple added support for marking your code in XCode 6 beta 4
From Xcode 6 on, you have to use
These preprocessor features allow to bring some structure to the function drop down box of the source code editor.
some examples :
-> will be preceded by a horizontal divider
// MARK: your text goes here
-> puts 'your text goes here' in bold in the drop down list
// MARK: - your text goes here
-> puts 'your text goes here' in bold in the drop down list, preceded by a horizontal divider
Please check the following screenshot to see how it looks when used:
Other available annotationsApart from MARK, XCode also support following two annotations:
landmarks to annotate your code and lists them in the jump bar. This is how these annotations look in jumpbar when used in XCode: