Add "Example" or "Usage" category in documentation

Originator:nacho4d
Number:rdar://21789369 Date Originated:
Status:Open Resolved:
Product:Xcode Product Version:Xcode 7 beta 2
Classification:UI/Usability Reproducible:Always
 
Summary:
Sometimes writing short examples in headers helps the developer to understand the API. I wish Xcode would have a dedicated place in its documentation viewer for "Usage" or "Example" code.

Steps to Reproduce:
1. Create a project with a swift file with the contents:

/// dispatch_after block after a delay
///
/// - usage:
///
///     delay(0.5) {
///     }
///
func delay(seconds: Double, block: dispatch_block_t) {
    let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC)))
    dispatch_after(delayTime, dispatch_get_main_queue(), block)
}


2. Alt + Click on the name of the function just declared

Expected Results:
I think it would be nicer to support "Usage" tag like in the attached picture (usage.png). (See link below)

Actual Results:
"- usage" or any other string is interpreted as simple markdown. There is no way to have a *dedicated* place for sample code. (I am aware of pre and code tags in markdown.)

Version:
Xcode 7 beta 2

Notes:


Configuration:


Attachments:
'usage.png' was successfully uploaded. -->

https://twitter.com/nacho4d/status/620490876825899008

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!