XCode macros and tags

When programing using XCode, we can use some macros or tags to assist the navigation of code. Some of them are listed as bellow.

#pragma mark

Syntax:

#pragma mark arguments

, where arguments can be - or other characters. 

Example:

#pragma mark -
#pragma mark Methods for view controller
#pragma mark - Methods for data source
would cause XCode to generate the following navigation items:

#warning

Syntax:

#warning message
, where message can be any characters.

Usage:

#warning is used to customize warning in an application.

#warning also finds its use in marking TODO and FIXME. I'd prefer to use #warning rather than TODO and FIXME when coding. After all warnings are resolved I feel assured that all features are implemented and issues are fixed. 

#error

Syntax:

#error message

, where message can be any characters.

Usage:

#error is used to customize error in a application.

How it can be used is to be researched.

// TODO:

Syntax:

// TODO: message
, where message can be any characters.

Usage:

One example use of // TODO: is to mark postponed implementation of a function so that it's easy to find what's left to do. We do this when constructing framework or building workflow of an application.

Caveats:

Only when // TODO is used outside member function can the message be listed in the navigation item list.

// FIXME: 

Syntax:

// FIXME: message

, where message can be any characters.

Usage:

One example use of // TODO: is to mark issues to be fixed. Reasons of that the issue may not be fixed by now can vary a lot. It can be caused by an interruption, or incompetent dependency, or other.

Caveats:

Only when //FIXME is used outside member function can the message be listed in the navigation item list.


P.S. For further information, please refer to Xcode and #pragma mark and Xcode FIXME and TODO

你可能感兴趣的:(XCode macros and tags)