Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6598675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:22:58+00:00 2026-05-25T18:22:58+00:00

Are there any guidelines/standards about how to document the code written in XCode? I

  • 0

Are there any guidelines/standards about how to document the code written in XCode? I mean, is there a way to document the code if you want to make it easily understandable to others? Does XCode provide an instrument that can be used to automatically produce documentation like the API reference docs from your code+comments?

At least I’m interested in understanding if there is a standard way of writing comments before interfaces/protocols/methods defined in your code. I’ve seen using directives like the following one, but I did not understand how they work:

#pragma mark -
#pragma mark Initialization
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:22:59+00:00Added an answer on May 25, 2026 at 6:22 pm

    You can merge those two lines in one: #pragma mark - Initialization. Click on the method list (up, right) and you’ll see a bold header with a line. It’s just a marker to group methods in sections.

    The Coding Guidelines link posted by Derek above is a must read.

    If you want to produce Apple-like documentation you have to use this excellent and free third party tool: http://www.gentlebytes.com/appledoc/ Apple doesn’t provide you with anything close to that.


    Pragmas are a ISO C feature to pass hints to the compiler.

    The only pragma addition in XCode (AFAIK) is mark with - and/or text. This creates a line and/or bold text in the method finder.

    // Mark a section in your code with a line and a bold text.
    // You can use the line or the text alone.
    #pragma mark - random text
    

    If you are editing files on languages which don’t compile with GCC, you still can use mark on comments (this works for GCC languages too):

    // MARK: - random text
    /* MARK: more random text */
    

    But I use #pragma mark because my color theme has pragmas in red and they stand out better than comments. If you want a pragma code snippet binded to a hotkey, use

    #pragma mark - <#Description#>
    

    so you can tab jump to the description text.

    More about pragmas:

    • What is a pragma?
    • 6.56 Pragmas Accepted by GCC
    • Clang’s Controlling Diagnostics via Pragmas
    • Function attributes are preferred to pragmas because you can’t generate pragmas from macros and a pragma might have a different meaning on another compiler.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any guidelines to writing Google App Engine Python code that would work
Is there any pdf which tells about coding guidelines in objective C. For Example...
I'm using guidelines right now, but I do not think there is any way
Are there any guidelines or standards out there for folder names starting with a
Is there any standards/guidelines/good practices for making websites with support of different content and
Are there any guidelines for testing multi-threaded code (other than throwing a bunch of
Are there any guidelines/best practices for deciding what type of data should be stored
Are there any guidelines on writing database tests so that you can refactor database
Is there any guidelines on how to differentiate between .nil? , .blank? and .empty?
Is there any guidelines to convert Table design to Div design keeping same cross

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.