4

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.

matt
  • 515,959
  • 87
  • 875
  • 1,141
John Doe
  • 2,225
  • 6
  • 16
  • 44
  • 4
    try using `@p` or `@c` this post is a bit old, but still has a bunch of useful options: https://stackoverflow.com/a/19169271/7833793 alternatively if you're trying to do a larger code block using @code // @endcode – R4N Apr 29 '19 at 17:50
  • 1
    So you’re saying Swift uses markdown but Objective C doesn’t. What an odd thing for Apple to do. – matt Apr 29 '19 at 17:58
  • 1
    Sure enough, `/// Checks if the given data is of type @c list.` works. Weird. – matt Apr 29 '19 at 18:02
  • @R4N Maybe post your comment as an answer, including pointing out that for Objective-C code, you use the Objective-C style, and for Swift you use the markdown style. – Kalle Oct 25 '21 at 07:03
  • 1
    @Kalle Added an answer, thanks for the follow up. – R4N Oct 25 '21 at 19:34

1 Answers1

3

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

R4N
  • 2,455
  • 1
  • 7
  • 9