Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode not formatting document comment properly for Objective-C code

I added the following comment with backtick for code:

/** Checks if the given data is of type `list`. */
+ (BOOL)isList:(id)object {
    // ..
}

but the backtick prints as in the Xcode quick help:

enter image description here

How to get Xcode to display code formatted properly? It works fine when documenting Swift source.

like image 695
johndoe Avatar asked Sep 06 '25 02:09

johndoe


1 Answers

As discussed in the comments above, in Objective-C documentation comments you can use @p or @c to display Typewriter font in the QuickHelp documentation. Whereas Swift documentation comments accept Markdown (using the backticks)

While this answers is relatively old, it still lists a good amount of the options available in Objective-C documentation comments: https://stackoverflow.com/a/19169271/7833793

Here's a brief example:

/// Here's how to use @c Typewriter @c Font
- (void)myMethod {}

Which displays this in the QuickHelp: enter image description here

like image 183
R4N Avatar answered Sep 07 '25 21:09

R4N