Xcode 8 how to show description of function while

2019-03-10 07:09发布

How can I show a brief description of a function while typing like the image show below? I've tried many different options all have failed.

enter image description here

Option + click works but that's not what I'm looking for.

Option 1

 /// Testing...
  /// - returns: false
  func testing()->Bool{
    return false
  }

Option 2

/**
Testing option two
*/
func testing()->Bool{
        return false
}

This issue has been fixed in Xcode 9

4条回答
我想做一个坏孩纸
2楼-- · 2019-03-10 07:32

I am using Xcode 9.4.1 and I found this...

enter image description here

Parameters picked from function automatically. Place your cursor on the line above the function.

/// <#Description#>
///
/// - Parameters:
///   - param1: <#param1 description#>
///   - param2: <#param2 description#>
查看更多
你好瞎i
3楼-- · 2019-03-10 07:32

Have you set:

Preferences -> Text Editing -> Suggest completions while typing

It might also help to install the guides and sample code at:

Preferences -> Components -> Documentation Tab -> "Check and Install Now" or the arrow next to guides and sample code to just download it once

查看更多
乱世女痞
4楼-- · 2019-03-10 07:43

If you are looking for the way to document self-created method in swift then this might give you a way out.

import Foundation
///                                                                     
查看更多
聊天终结者
5楼-- · 2019-03-10 07:50

Select your function or place the cursor before your function, then click

Xcode - Editor - Structure -> Add Documentation.

/**
 <#Description#>
 */

Save the file, or simply restart the Xcode. Then check the suggestion while calling the respective function. I hope this might help.

查看更多
登录 后发表回答