Comments are used to include nonexecutable code in text, such as notes and reminders.
// This is a simple comment.
A multiline comment can be started with
/* and ended with
/* This is a comment written over a whole big long bunch of lines. */
Special comment syntax
Xcode recognizes special comment syntax and can display these comments in a file’s quick-jump dropdown bar.
MARK can be used to display a comment in the bar:
// MARK: View Set Up
A dash (-) can be added to display a line above the comment:
// MARK: - View Set Up
A bar without a comment can be added with a simple dash:
// MARK: -
TODO is used to display a reminder of something that needs to be done:
// TODO: Update logic to accommodate data changes.
FIXME is used to display a reminder of something that needs to be fixed:
// FIXME: Fix glitchy behavior when making changes to an existing entry.