In Objective C, we can use
#pragma mark
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
Fortunately, apple added support for marking your code in XCode 6 beta 4
From Xcode 6 on, you have to use
// MARK:
These preprocessor features allow to bring some structure to the function drop down box of the source code editor.
some examples :
// MARK:
-> 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:
Please check the following screenshot to see how it looks when used: