大佬教程收集整理的这篇文章主要介绍了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面板,其中包含我输入的信息.
但是,当我开始键入方法签名并弹出自动完成时,它不会像在Apple的API中那样在自动完成框的底部显示此信息.
我的评论语法在哪里,我错了?
看看这里:https://stackoverflow.com/a/43982094/1415898获得更完整的答案.
以上是大佬教程为你收集整理的Swift方法文档 – 未在自动完成中显示全部内容,希望文章能够帮你解决Swift方法文档 – 未在自动完成中显示所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。