As of Xcode 6, current is Xcode 10.1, the IDE recognizes
// MARK:
// TODO:
// FIXME
in Swift source and lists them in the jump bar. Formerly in Objective C, developers used #pragma mark
to mark sections of code in the symbol navigator. Due to this being a C preprocessor command, it is not available in Swift.
Swift Engineers at Apple recommend that liberal use of class extensions might be a better practice. Due to extensions implementing protocols, developers can put all of the table view delegate methods in an extension and group the code at a more semantic level than #pragma mark
is capable.
Additionally, using typealias
for the extensions to be named, such as typealias DataSource = SwiftTableViewController
. Then extension Datasource {}
This will allow it to show up in the method navigation menu like #pragma mark
was used to separate the menu items.