iOS  Tree

"All of us do not have equal talent. But , all of us have an equal opportunity to develop our talents.” – A.P.J Abdul Kalam

PRAGMA MARK (#pragma mark) — June 12, 2017

PRAGMA MARK (#pragma mark)

  1. One of the best features in Xcode that developers forgot to use is #pragma mark directives
  2. Pragma mark is simply a way to organize your methods at method pop up list in Xcode & help us to better code implementation.
  3. It has no impact on your code only just to find the method easily and reference

Objective c:

#pragma mark
Example
# pragma mark example
- (void) pragmaMarkExample {
//function body
}

pragmaMark1

# pragma mark - example
- (void) pragmaMarkExample {
// function body
}

PragmaMark2

Swift:

//MARK:

// MARK: create only the title
func pragmaMark() {
//function body
}

pragmaMark3

//MARK:-

// MARK:- create only the title
func pragmaMark() {
//function body
}

PragmaMark4

Create only separator for methods

// MARK:
func pragmaMark() {
//
}

PragmaMark5

Xcode now supports //TODO: and //FIXME: landmarks to annotate your code and lists them in the jump bar.

//TODO: or //TODO: -

  1. When you need to set a reminder for code that you need to revisit TODO will be used.
  2. TODO can be used either inside or outside a method.

//FIXME: or //FIXME: -

  1. Fixme works in a similar manner, as it can be place either inside or outside a method.
  2. Fixme is used to refer a bug, later you can track and fix it easily.


// MARK: - Pragma Mark
func validation() {
//TODO: something here
//FIXME: Fix the error
}

pragmaMark6

// MARK: - Pragma Mark
func validation() {
//TODO: - something here
//FIXME: - Fix the error
}

pragmaMark7