Xcode 8如何在input时显示function的描述

如何在打字时显示function的简要说明,如下图所示? 我已经尝试了许多不同的select都失败了。

在这里输入图像说明

选项+点击作品,但这不是我要找的。

选项1

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

选项2

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

这个问题已经在Xcode 9中解决了

select您的function或将光标放在您的function之前,然后单击

 Xcode - Editor - Structure -> Add Documentation. /** <#Description#> */ 

保存文件,或者干脆重新启动Xcode。 然后在调用相应的function时检查build议。 我希望这可能有帮助。

你有没有设置:

首选项 – >文本编辑 – >在input时build议完成

这也可能有助于安装指南和示例代码:

首选项 – >组件 – >文档选项卡 – >“立即检查并安装”或旁边的箭头和示例代码,只需下载一次

如果你正在寻找方法来迅速logging自我创build的方法,那么这可能会给你一个出路。

 import Foundation /// 🚲 A two-wheeled, human-powered mode of transportation. class Bicycle { /** Frame and construction style. - Road: For streets or trails. - Touring: For long journeys. - Cruiser: For casual trips around town. - Hybrid: For general-purpose transportation. */ enum Style { case Road, Touring, Cruiser, Hybrid } /** Mechanism for converting pedal power into motion. - Fixed: A single, fixed gear. - Freewheel: A variable-speed, disengageable gear. */ enum Gearing { case Fixed case Freewheel(speeds: Int) } /** Hardware used for steering. - Riser: A casual handlebar. - Café: An upright handlebar. - Drop: A classic handlebar. - Bullhorn: A powerful handlebar. */ enum Handlebar { case Riser, Café, Drop, Bullhorn } /// The style of the bicycle. let style: Style /// The gearing of the bicycle. let gearing: Gearing /// The handlebar of the bicycle. let handlebar: Handlebar /// The size of the frame, in centimeters. let frameSize: Int /// The number of trips travelled by the bicycle. private(set) var numberOfTrips: Int /// The total distance travelled by the bicycle, in meters. private(set) var distanceTravelled: Double /** Initializes a new bicycle with the provided parts and specifications. - Parameters: - style: The style of the bicycle - gearing: The gearing of the bicycle - handlebar: The handlebar of the bicycle - frameSize: The frame size of the bicycle, in centimeters - Returns: A beautiful, brand-new bicycle, custom built just for you. */ init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int) { self.style = style self.gearing = gearing self.handlebar = handlebar self.frameSize = centimeters self.numberOfTrips = 0 self.distanceTravelled = 0 } /** Take a bike out for a spin. - Parameter meters: The distance to travel in meters. */ func travel(distance meters: Double) { if meters > 0 { distanceTravelled += meters ++numberOfTrips } } } 

在这里输入图像说明

Swift – 关于NSHipster的文档