Swift方法文档 – 未在自动完成中显示

Swift方法文档 – 未在自动完成中显示,第1张

概述我正在记录我的 Swift方法如下: /// Extracts the server time from the API call response./// - parameter response: The HTTPURLResponse from which to extract the date./// - returns: The 'Date' header from the resp 我正在记录我的 Swift方法如下:

/// Extracts the server time from the API call response./// - parameter response: The httpURLResponse from which to extract the date./// - returns: The 'Date' header from the response,as a `Date` object./// - throws: If the 'Date' header is not found,or cannot be parsed to a `Date` object.static func extractServerTimeFromresponse(_ response: httpURLResponse) throws -> Date {    guard let serverTimeString = response.allheaderFIElds["Date"] as? String else {        throw RGOTimeSyncHelperError.invalIDServerResponse    }    let formatter = DateFormatter()    formatter.dateFormat = "EEE,dd MMM yyyy HH:mm:ss zzz"    guard let serverTime = formatter.date(from: serverTimeString) else {        throw RGOTimeSyncHelperError.dateParsingError    }    return serverTime}/// Calculates the offset of the local time compared to the server time./// - parameter serverTime: The time from the server./// - returns: The amount of seconds that need to be added to the clIEnt time,to match the server time.static func calculateOffset(serverTime: Date) -> Int {    let localTime = Date()    let offset = Calendar.current.dateComponents([.second],from: localTime,to: serverTime).second!    return offset}/// Add an offset in seconds to a given date./// - parameter date: The date to which to offset should be applIEd./// - parameter bySeconds: The offset,in seconds,that will be applIEd to the given date./// - returns: A new `Date` object,comprised of the given date,with the given offset applIEd.static func offset(date: Date,bySeconds offset: Int) -> Date {    let offsetDate = Calendar.current.date(byAdding: .second,value: offset,to: date)!    return offsetDate}

当我在任何地方双击方法签名时,Xcode会显示quickhelp面板,其中包含我输入的信息.

但是,当我开始键入方法签名并d出自动完成时,它不会像在Apple的API中那样在自动完成框的底部显示此信息.

我的评论语法在哪里,我错了?

解决方法 原因是Xcode从单独的doc-set解析popover中显示的文档,而不是从类文件本身解析.

看看这里:https://stackoverflow.com/a/43982094/1415898获得更完整的答案.

总结

以上是内存溢出为你收集整理的Swift方法文档 – 未在自动完成中显示全部内容,希望文章能够帮你解决Swift方法文档 – 未在自动完成中显示所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1005915.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存